How to get Page Title and URL using jQuery

Yesterday for one of my requirement, I need to get the title and URL of the page. This can be easily done with jQuery. In this post, I will show you a jQuery code snippets which will get the URL and Title of the page using jQuery.

$(document).ready(function () {
   var vhref = $(location).attr('href');
   var vTitle = $(this).attr('title');
   $('#spnTitle').html('' + vTitle + '');
   $('#spnURL').html('' + vhref + '');
});?

See result below.

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...