Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find title text of a link

Tags:

jquery

How do I find the title text of a link in jquery.

like image 522
baljit Avatar asked Dec 06 '22 03:12

baljit


2 Answers

You can use attr to find title attribute.

var title = jQuery("a").attr("title"); //replace "a" with your own selector
like image 147
Chandra Patni Avatar answered Jan 01 '23 17:01

Chandra Patni


I think you mean the text of the link:

var link_text = $('#someLink').text();

If you mean the title attribute (the text that you see when you hover over the link):

var link_title = $('#someLink').attr('title');
like image 36
Jacob Relkin Avatar answered Jan 01 '23 17:01

Jacob Relkin