how to filter on a private data value using jquery?
Example of the content of level_1_File, I only want to display a P element with the data-test_name of value level_1
<p data-test_name="level_1"> Level 1 test results have passed </p>
<p data-test_name="level_2"> Level 1 test results have passed </p>
<p data-test_name="level_3"> Level 1 test results have passed </p>
<p data-test_name="level_4"> Level 1 test results have passed </p>
$.get(level_1_File, function(data)
{
$.each($(data), function(index, value))
{
alert($(value).html());
}
});
This works but I only need the P element that has a data-test_name of value level_1, how do I filter for only this value?
1 Answer