I’m looking for a command to clean the beginning of content inside my form
but I would like to preserve last elements (that are some buttons (tag a)
$('#Detail form').not('a').html('');
is not working
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to select the children of the
form, and then remove theaelements from the collection:Note that I’ve used
remove, which will actually remove any elements that are notaelements from the DOM. If you don’t want that, then you can replace the call toremovewith your call tohtml, which will simply remove all content from those elements.Your current code will select all
formelements that are descendants of#Detailand then try to remove allaelements from the collection. Since you have only selectedformelements, there are obviously not going to be anyaelements to remove!