JSFiddle - React, Tailwind, and code Playground
by Owais Kiani
HTML
<div >
<button type="button" name="abc" class="my_class" custom_attr="field1 field2"> Match</button>
</div>
<div>
<input name="def" condation="field1 user_defined"/>
<input name="jkl" condation="field2 user_defined"/>
<input name="jkl" condation="field13 user_defined"/>
</div>
JavaScript
(function ($) {
$(".my_class").click(function() {
var custom_attr = $(this).attr('custom_attr');
$("input").each(function(){
var condation = $(this).attr('condation');
if(condation == custom_attr){
alert('match');
}
else{
alert('not match');
}
});
});
})(jQuery);