I am trying to run a specific javascript - only if a specific radio button is selected.
- If radio button - Both is selected - Line 1 and Line 2 must equal
My java code is
$(document).ready(function() {
$('#q3').click(function () {
if($('input[value="BothA"]').is(':checked'))
{$('.Submit').hide();
$('.cat2 input').on('blur change', function() {
if (parseInt($('.cat input').val(), 10) == parseInt($('.cat2 input').val(), 10)) {
$('.Submit').show();
} else {
$('.Submit').hide();
alert("Error in math - Total Hours does not match Split Hours");
}
});
});
- I confirmed that "Part One" of the code will work independently
$(document).ready(function() {
$('#q3').click(function () {
if($('input[value="BothA"]').is(':checked'))
{
alert("Error in math - Total Hours does not match Split Hours");
}
});
});
- I also confirmed that "Part Two" of the code will work
$(document).ready(function() {
$('.Submit').hide();
$(.cat2 input').on('blur change', function() {
if (parseInt($('.cat input').val(), 10) == parseInt($('.cat2 input').val(), 10)) {
$('.Submit').show();
} else {
$('.Submit').hide();
alert("Error in math - Total Hours does not match Split Hours");
}
});
});
Any suggestions on how to combine these items would be appreciated.