JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" attr123='something' value='hello' />
<input type="text" abcdasda3='something' value='hello2' />
<input type="text" sadwqwda='something' value='hello3' />
<div id='result'></div>
JavaScript
/*!
* listAttributes jQuery Plugin v1.1.0
*
* Copyright 2010, Michael Riddle
* Licensed under the MIT
* http://jquery.org/license
*
* Date: Sun Mar 28 05:49:39 2010 -0900
*/
if(jQuery) {
jQuery(document).ready(function() {
jQuery.fn.listAttributes = function(prefix) {
var list = [];
$(this).each(function() {
var attributes = [];
for(var key in this.attributes) {
if(!isNaN(key)) {
if(!prefix || this.attributes[key].name.substr(0,prefix.length) == prefix) {
attributes.push(this.attributes[key].name);
}
}
}
list.push(attributes);
});
return (list.length > 1 ? list : list[0]);
}
});
}
$(document).ready(function(){
$('input').each(function(){
var attrs = $(this).listAttributes();
for(var i=0;i<attrs.length;i++){
if(attrs[i].indexOf("abc")>-1) itemProccess($(this));
}
});
});
function itemProccess(item){
console.log(item);
$('#result').html(item.val()+' is the input you are looking for')
}