Your input selector is using ^=
, which matches the exact START of a value, yet your values don't start with that value. I suggest changing that to *=
so it searches anywhere within the ID. Reference jQuery Docs
Second, you're forgetting a closing '
quote for that selector.
That fixes the selector issues for activation. Now you just need to trigger a common function to check if both Date and Radio (in the same line) have been filled out.
This activates the checkProtocol()
function when a date is selected and passes the input text element along to it.
$(this).datepicker({
onSelect: function() { checkProtocol( this ) }
});
This activates the checkProtocol()
function when a radio button has been selected for that group and passes that element along as a parameter.
$("input[id*='protocol_protocol']").change( function() { checkProtocol(this) } );