JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<img data-plugin-info="test" src = "http://dummyimage.com/120x90/f00/fff.png&text=data-plugin" />
<img data-whatever="test" src = "http://dummyimage.com/120x90/f00/fff.png&text=data-whatever" />
JavaScript
$.extend($.expr[':'],{
attrNameStart: function(el,i,props) {
console.log(arguments);
var hasAttribute = false;
$.each( el.attributes, function(i,attr) {
if( attr.name.indexOf( props[3] ) !== -1 ) {
hasAttribute = true;
return false; // to halt the iteration
}
});
return hasAttribute;
}
});
alert( 'Found: ' + $('img:attrNameStart(data-plugin)').length );