Link to home
Start Free TrialLog in
Avatar of Melody Scott
Melody ScottFlag for United States of America

asked on

Use an oninput event to change states of another field

I have sort of a related question here: https://www.experts-exchange.com/questions/29151129/use-an-oninput-event-to-change-states-of-button.html

Please go to: https://dev.magickitchen.com/menu/main_courses.html  and add something to the cart. If you need user/pw, please use mel/mel.

Then add a zip code and click on checkout. On the checkout page, you will see this:

User generated image
What I would like to do is, if someone enters text into the field Company, I'd like the dropdown to automatically change from Residential to Commercial. Is that possible with jquery?
Avatar of Melody Scott
Melody Scott
Flag of United States of America image

ASKER

Thanks, will give it a try! Just a note, that should have gone on this question, right? https://www.experts-exchange.com/questions/29151129/use-an-oninput-event-to-change-states-of-button.html
Avatar of leakim971
deleted, my bad!
$("#companyID").on("input", function() {
         if( $.trim( $(this).val() ) != "" )
                   $("#addressType").val("Commercial");
});

Open in new window


replace companyID and addressType by, respectivly the ID of the company textbox and address type dropdown
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks! I will give this a try!
Looks like I am out of hours for the week, so next Monday I'll get back to you.
Could you close the question please?
Haven't made it work yet.
Sorry that took so long! Works like a charm.