Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting attribute value in event handling code for JQuery / CC selector

Tags:

jquery

css

I have a JQuery selector with some simple event handling attached.

jQuery('.ui-jqgrid-sdiv td[aria-describedby*="SUM"]').click(function(event) {alert('SUM=')}); 

Now, I want to find the exact value of the aria-describedby attribute. This could be say

SUM_1
SUM_2
SUM_3
SUM_4

Any tips how I do this?

Thanks.

like image 338
More Than Five Avatar asked Apr 19 '13 11:04

More Than Five


1 Answers

By using .attr() you can get it

try this

$('.ui-jqgrid-sdiv td[aria-describedby*="SUM"]').click(function(event){
   alert($(this).attr('aria-describedby'));
}); 
like image 186
PSR Avatar answered Nov 09 '22 19:11

PSR