I need to fire the change event when other JavaScript function changes the checked status.
Simplified code below. I can not call MyFunc()
from MyOtherFunc()
.
jQuery:
$(document).ready(function(){
$('input:radio[name=rdName]').change(function(){
MyFunc();
});
});
function MyFunc(){
//do stuff
}
function MyOtherFunc(){
$('input:radio[name=rdName]')[0].checked = true;
// Was unable to have it change based on a value
}
Radio buttons:
<input type="radio" name="rdName" value="1">
<input type="radio" name="rdName" value="2">
<input type="radio" name="rdName" value="3">
$('input:radio[name=rdName]').change();