jquery.f5 icon indicating copy to clipboard operation
jquery.f5 copied to clipboard

Removing required="required" with jQuery does not work in IE7 or 8

Open brupm opened this issue 13 years ago • 2 comments

I set a text field required="required" on the html side <input type="text" name="title" id="title_input" placeholder="e.g. Placeholder" value="some value" required="required" maxlength="200" />

then upon user input I use jQuery to trigger a the following change:

jQuery("#title_input").prop('required', false);

The error message is no longer shown on FF, Chrome or Safari if the field is left empty, but it still persists in IE even though the prop has been set to false. I tried with removeAttr() and well as removeProp(), same issue.

I noticed that in the source code you use $$.attr('required'), I tried using $$.prop('required') but that did not make a difference.

My goal is to be able to change field requirements with jQuery post page load depending on user input.

Thank you

brupm avatar Jan 23 '12 23:01 brupm

Hmm. To be honest, I just had no idea that one wants to manipulate the form properties via jQuery. Can you show me example?

akaspin avatar Jan 24 '12 00:01 akaspin

You have to run $('form').f5() on the DOM after writing it.

maletor avatar Jun 26 '12 20:06 maletor