I want to get element by class and data attribute and add disabled to this element
<code><button type="button" data-pid="23" class="add " tabindex="0">click me</button>
$(".add").on("click", function(e) {
e.preventDefault();
var pid = $(this).attr('data-pid');
$('.add[data-pid="'+pid+'"]').attr("disabled", "disabled");
});
</code>
<code><button type="button" data-pid="23" class="add " tabindex="0">click me</button>
$(".add").on("click", function(e) {
e.preventDefault();
var pid = $(this).attr('data-pid');
$('.add[data-pid="'+pid+'"]').attr("disabled", "disabled");
});
</code>
<button type="button" data-pid="23" class="add " tabindex="0">click me</button>
$(".add").on("click", function(e) {
e.preventDefault();
var pid = $(this).attr('data-pid');
$('.add[data-pid="'+pid+'"]').attr("disabled", "disabled");
});
this code not work
thanks