This is a handler for the load
event. Inside we define a change
handler for #radio
. Inside it I have used the code you have shared with us. Note, that $(this)
is the radio
element, as it is used inside the radio
element's change
handler. Also note that num1
needs to exist at this point.
$(function() {
$('#radio1').change(function() {
if($(this).is(':checked')) {
num1 = "First Number";
$('#blockID').trigger('collapse');
}
});
});