I’m new to JavaScript so need a help please. Basically I’ve two radio buttons and one submit button. I want to use JS function when submit button is clicked to pick the value of radio button.
<td align="right" style="width: auto">
@Html.RadioButton("SelectedOption", LinkOption.Link, true) Link Account
</td>
<td align="left" style="width: auto">
@Html.RadioButton("SelectedOption", LinkOption.DeLink, false) De-Link Account
</td>
<td align="right" style="width:50%">
<input type="submit" id="linkAccountSubmit" onclick="activeDeLink()" />
</td>
And the JavaScript function is; where I want to use the if statement to pick the value of radio buttons
function activeDeLink() {
if (............) {
$('.hiddenLink').each(function () {
$(this).removeClass('hiddenLink');
});
}
else
{.......}
}
you can get the value in this way:
Remember that your form will be submitted if you not return a boolean value from the function