asked on September 5, 2014
•
Show version history
I am currently working on a form that if the user selects an option either yes or no two other drop downs are to match. I am having some trouble trying to set the values identically to each other. Here is a block of my code which checks this:
$(document).ready(function () { $('#Field3').change(function () { var isDifferent = $('.isDifferent').find(':selected').val(); var jobOne = $('.jobClassOne').find(':selected').val(); var jobTwo = $('.jobClassTwo').find(':selected').val(); if(isDifferent == "No") { $('.jobClassTwo').val($('.jobClassOne').find(':selected').val()).attr("selected", "selected"); //document.write("<p>Have a nice day!</p>"); } }); });
The document.write was only to be used to test if the branch was successful.
Edit:
The two fields that need to match are jobOne and jobTwo.
0
0