disable all form elements inside div

amirash picture amirash · Mar 13, 2011 · Viewed 271.6k times · Source

is there a way to disable all fields (textarea/textfield/option/input/checkbox/submit etc) in a form by telling only the parent div name in jquery/javascript?

Answer

Andrew Whitaker picture Andrew Whitaker · Mar 13, 2011

Try using the :input selector, along with a parent selector:

$("#parent-selector :input").attr("disabled", true);