I have a drop down menu and checkbox group. For example, like this:
Menu
Option 1
Option2
Radio button
yes
no - turned on by default
is it possible, through the use of an element event, to make it so that if menu option 1 is selected that the Yes option would be selected for the radio button?
Menu
Option 1
Option2
Radio button
yes
no - turned on by default
is it possible, through the use of an element event, to make it so that if menu option 1 is selected that the Yes option would be selected for the radio button?
Hi scottchr,
Yes and no, you could do it but you'd need to use a Custom function - and, in this case you might just as well use custom JavaScript without using the event.
You can see my test here
Bob
Yes and no, you could do it but you'd need to use a Custom function - and, in this case you might just as well use custom JavaScript without using the event.
jQuery(document).ready(function(jQ) {
// run the checkon page load and when the select changes
setRadio();
jQ('#dropdown1').on('click', setRadio);
function setRadio() {
if ( jQ('#dropdown1 option:selected').val() == 'option_1' ) {
jQ('input:radio[name=radio2]').val(['yes']);
} else {
jQ('input:radio[name=radio2]').val(['no']);
}
}
});
You need to update the element names, ids and values to match yours.
You can see my test here
Bob
This topic is locked and no more replies can be posted.