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][data-i=3]')u can use it like this