Skip to content Skip to sidebar Skip to footer

Disabling And Re-enabling Dynamic Form Elements With Jquery

It's probably easiest to view this fiddle: http://jsfiddle.net/Ahfm7/4/ Only the agent and extension values in the dropdown have been implemented at this time. I have encountered a

Solution 1:

I started cleaning up the code. I cut the 700+ lines of JS down to something more manageable for SO, but you should be able to understand the general idea.

http://jsfiddle.net/mattball/5ubTe/

In general:

  • Avoid re-querying the DOM by caching jQuery objects
  • Stay DRY by writing more, smaller functions which contain commonly reused logic (such as the enableSubmitButton function I added)
  • Don't forget to use var

Solution 2:

I finally almost have a complete working solution but with one bug:

http://jsfiddle.net/5ubTe/72/

Thanks for your advice.

Post a Comment for "Disabling And Re-enabling Dynamic Form Elements With Jquery"