How can I select a DOM element that has two data- attributes matching my values using jQuery? My element is
<a data-published="true" data-i ="3"></a>
I need to select this element.
How can I select a DOM element that has two data- attributes matching my values using jQuery? My element is
<a data-published="true" data-i ="3"></a>
I need to select this element.
It will be a[data-published="true"][data-i ="3"]
var $el = $('a[data-published="true"][data-i ="3"]');
console.log($el.length);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a data-published="true" data-i ="3"></a>
$('a[data-published="true"]').val
so on your code.. if you want to match both then
$('a[data-published="true"][data-i="3"]').val