I have a jQuery ajax get that will return an html text. From this one I need to extract the h3 element (with id='title') value: THIS IS TITLE
.
Can I achieve this with jQuery?
<div class="content">
<h3 id="title">THIS IS TITLE</h3>
.....
</div>
and here is the call:
$.ajax({
url: url,
type: 'GET',
cache:false,
success: function (data) { // data is the html text returned
alert('The title is: ' + TITLE HERE);
}
});
Use find() method to get the value like below,
$(data).find('#title').text()
An Example for how to use find is here How to Use find()
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