I have radio button field and it has default selected value, so how to trigger on change event without changing any radio button value when page loads. In my app I need to disable few dropdowns based on default selected radio button value
Asked
Active
Viewed 602 times
-1
-
1please provide sample html and javascript code – jtate Oct 09 '18 at 18:13
-
Check out https://stackoverflow.com/questions/2490825/how-to-trigger-event-in-javascript; I think that covers the same ground. – Jacob Oct 09 '18 at 18:15
1 Answers
1
you can use do like...
when page loads
$(document).ready(function(){
//On page load, here you can check your radio button value
var val= $('input[name=name_of_your_radiobutton]:checked').val();
//on the basis of val you can add logic
dowork()
});
You can put your common logic into some function...
function dowork()
{
//put your common logic here
}
Now you can call this method(dowork) on both event(Page Load and Radio Button change event)

mukesh kudi
- 719
- 6
- 20
-
Thanks for reply, but am looking for something to write common functions for both page loads and radio button selected or changed – user2529774 Oct 09 '18 at 18:27