I’m using jquery to show/hide a form text input depending on the value of a checkbox:
$(document).ready(function(){
$(“input[name$=‘usr_type’]”).click(function(){
var radio_value = $(this).val();
if(radio_value==‘1’) {
$("#typeother").show(“slow”);
}
else if(radio_value==‘2’) {
$("#typeother").hide();
}
});
$("#typeother").hide();
});
Above works great.
However, I also need to SHOW the form input if a returned database value matches 1 as well.
[php]if ($gtprsn[‘usr_type’] == 1); { … how the freaking text input … }[/php]
Nothing I’ve tried so far works. I can add an if statement to the input itself to add a style and it will display:
[php]<?php if ($gtprsn['usr_type'] == 3): ?>style=“display:block !important;”<?php endif; ?>[/php]
But this then overrides the jquery and if I check the other radio button (value 2), the input still shows…
Suggestions?