Which would have better performance?
$('input[data-confirm],a[data-confirm],button[data-confirm]');
or
$('[data-confirm]');
Obviously the $('[data-confirm]')
version of the selector is more flexible, will it mean jQuery has to scan every single element in the page to see if it has the data-confirm attribute. Would I be better to use a class instead? I like using the data-confirm
because I can put this in the value.
<input type="submit" data-confirm="Are you sure you want to do this sir?" />