Eiolon Posted July 5, 2011 Share Posted July 5, 2011 I am using a script that simulates an onclick if a checkbox was selected when my record loads, but have not been able to modify it for a radio button and if a certain value is selected. Here is what I am using: <script type="text/javascript"> window.onload = function() { if (document.forms[0].checkboxname.checked == true) { document.forms[0].checkboxname.onclick(); } } </script> Any ideas? thnaks! Link to comment https://forums.phpfreaks.com/topic/241139-simulate-onclick-if-certain-radio-button-is-selected/ Share on other sites More sharing options...
AyKay47 Posted July 5, 2011 Share Posted July 5, 2011 why can't you simply invoke an onclick event from the input tag? <input type="radio" name="group1" value="Milk" onclick="someFunc()"> Milk<br> Link to comment https://forums.phpfreaks.com/topic/241139-simulate-onclick-if-certain-radio-button-is-selected/#findComment-1238621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.