Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select td based on data attribute [duplicate]

Tags:

jquery

Possible Duplicate:
Jquery selectors on custom data attributes on HTML5

How can I select all td with html data attribute equal to some value?

E.G. Fiddle

$("td").dblclick(function (e) {    
    var columnNumber = $(this).data('column');
    console.log(columnNumber);
    $("td column=" + columnNumber).css('background-color', 'blue');;
});
like image 348
P.Brian.Mackey Avatar asked Jul 31 '12 19:07

P.Brian.Mackey


1 Answers

here is the good syntax :

$("td[data-column='"+columnNumber+"']")
like image 181
Yukulelix Avatar answered Oct 26 '22 21:10

Yukulelix