I've been working on a script to loop through my form inputs and check for the presence of the style
attribute. Despite feeling like I'm close to getting it right, there seems to be an issue with my code. There are actually only 2 inputs with the style
attribute, but my current implementation is mistakenly detecting all 9 form elements as having this attribute.
Below is the code snippet in question:
$("#form-builder-wrapper input").each(function() {
var styleAttr = $(this).attr('style');
if (typeof styleAttr !== typeof undefined && styleAttr !== false) {
alert('Has style attribute');
}
});