It's probably easiest to view this fiddle: <a href="http://jsfiddle.net/Ahfm7/4/" rel="nofollow">http://jsfiddle.net/Ahfm7/4/</a>
Only the agent and extension values in the dropdown have been implemented at this time.
I have encountered a couple of bugs I was hoping someone could help figure out.<ul><li>
The first is when you add a new row of dropdowns without selecting anything in the first and proceed to select an option in the second one, the form can be submitted.</li> <li>
Likewise if you pick an option in the first row, then add another and remove it, the submit button remains disabled.</li> </ul>
I was just wondering if anyone knows how to fix this?Answer1:
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.
<a href="http://jsfiddle.net/mattball/5ubTe/" rel="nofollow">http://jsfiddle.net/mattball/5ubTe/</a>
In general:<ul><li>Avoid re-querying the DOM by caching jQuery objects</li> <li>Stay <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="nofollow">DRY</a> by writing more, smaller functions which contain commonly reused logic (such as the
enableSubmitButtonfunction I added)</li> <li>Don't forget to use
I finally almost have a complete working solution but with one bug:
<a href="http://jsfiddle.net/5ubTe/72/" rel="nofollow">http://jsfiddle.net/5ubTe/72/</a>
Thanks for your advice.