How to remove first span element after <input id="mytxt" type="textbox"/>
, if it exists?
$('#mytxt').live('change', function(){
//TO DO
}
Within your live function, do this:
$(this).next("span").remove();
I think you have to check the first "SPAN" element after the element. so you have to go till the end of the document
var element = $(this).next();
while($(element)[0].tagName!="SPAN" && $(element).length!=0){
element = $(element).next();
}
if($(element)[0].tagName=="SPAN"){
$(element).remove();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With