I have html saved in a variable
var itinerary = $('.events_today').html() ;
I have lots of html and one button I want to remove. It has the id "myButton". How can I remove it from the html saved in my variable
I suggest this approach
var itinerary = $('.events_today')
.clone(true) /* get a clone of the element and from it */
.find('#myButton') /* retrieve the button, then */
.remove() /* remove it, */
.end() /* return to the previous selection and */
.html() ; /* get the html */
Try this:
itinerary.filter(function() { return $(this).not("#myButton"); });
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