I have a variable var 'html'
, it contains some html codes .in it there is a div with id messages
. I want to get only that div contents from the 'html' variable into another variable using javascript.
Please help . .
The easiest way with jQuery in my opinion:
var message = $('<div />').append(html).find('#message').text();
//.html();
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