flynny
asked on
jquery .remove div with multiple classes not working
Hi all,
I am trying to remove a dynamically created div with classes using jquery. If i add an id to the div the remove works (i.e. .remove('#<ID>'); but when its not removing based on a css class or classes.
Can anyone help please?
its a basic method I have for highlighting any fields which are either valid or invalid.
I am trying to remove a dynamically created div with classes using jquery. If i add an id to the div the remove works (i.e. .remove('#<ID>'); but when its not removing based on a css class or classes.
Can anyone help please?
function highlightField(textfield, valid) {
if (textfield.parent().is(".textbox-wrapper")) {
textfield.parent().remove('.input-status.input-cross'); //not working
textfield.parent().remove(".error-popup"); //not working either?
textfield.parent().remove(".valid-popup");
alert('removed any popups');
textfield.unwrap();
}
textfield.wrap("<div class='textbox-wrapper'></div>");
if (!valid) {
textfield.removeClass("valid"); //just in case
textfield.addClass("error");
textfield.parent().append("<div class='input-status input-cross'></div>");
}
else {
textfield.removeClass("error"); //just in case
textfield.addClass("valid");
textfield.parent().append("<div class='input-status input-tick'></div>");
}
}
its a basic method I have for highlighting any fields which are either valid or invalid.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window
also if I alert out the html i.e.
Open in new window
which seems correct i think?