How to get a value of the property in jquery?
The code looks like this,
<a cla开发者_Python百科ss="foo" title="a"></a>
<a class="foo" title="b"></a>
<a class="foo" title="c"></a>
How can I get the second value of title when clicking the second ?
$('.foo').click(function(){
alert($(this).attr('title'));
});
Try it!
Very easy:
$('a.foo').click(function() {
console.log($(this).attr('title'));
});
Hope this will help you
$(document).ready(function(){
$(".foo").click(function(){
alert($(this).attr("title"));
});
});
something like
$('.foo').click(function() {
alert($(this).attr('title'));
});
$(".foo").click(function(){
$(this).attr("title");
});
精彩评论