How to get the title attribute of a div element? 1

If you are trying to get the title attribute of any HTML element, then use the following Jquery code to alert or get the required title.


<div class='car' id='car' title='This is a div for cars!'>

    Displaying your favourite cars!


Jquery to alert title element on page load.


    $(document).ready(function() {

    var title_val=$("#car").attr('title');






This is a div for cars!



You can use this JQuery to alert the title on click as well.