Yetimwork Beyene
Yetimwork Beyene

Reputation: 2337

how to loop through a set of elements with a data attribute value using jquery?

how to loop through a set of elements with a data attribute value using jquery? I tried this... alert(variableName); // works

    $("SectionATable tr [data-testlog='"+variableName+"']").each(function()
    {
                alert("sectionA log");
    });

No error shows up in firebug....

Upvotes: 1

Views: 508

Answers (2)

Bill
Bill

Reputation: 3517

you had a few small syntax errors, try this:

$("#SectionATable tr [data-testlog="+variableName+"]").each(function(){
    alert("sectionA log");
});

Upvotes: 2

Roar
Roar

Reputation: 2167

Attribute Equals Selector [name="value"]

here are selecotrs http://api.jquery.com/category/selectors/

Upvotes: 1

Related Questions