Hi,
I managed to implement this on a client project,
I also came across the same problem when updating the select field,
Basically we need to trigger change event of the select field right after updating it, you need to do this with vanilla JS,
jQuery’s trigger(“change”) can’t do it.
selectElement.value = "new value" // update select field's value
setTimeout((el)=>{ // trigger change event of the select field.
e=document.createEvent('HTMLEvents');
e.initEvent('change',false,true);
el.dispatchEvent(e)
},0, selectElement)
I’m currently trying to set this up on our site but I’m having some difficuly going through the code.
Can you expand a bit on how you were able to get this to work?
No I haven’t got any code set up.
Instead of radio buttons I’ve got three link blocks that I would like to use to control the variation that is selected and was hoping the above would do the job but I’m a bit lost with it.
I’ve also been trying to use the code here to change the variation but haven’t had any luck.
Here’s the page I’m working on at the minute >> Webflow - STAND
Radio buttons or links are not necessary you can do it even with a div element, but you need JS to link the click event of the source element (link block in your case) to the select element.
Yes this is where I am struggling as I’m not very experienced with JS.
I can assign an id to the link blocks but that I don’t know how to take the click event and make it change the selected variant.