I'm using jquery to show/hide a form text input depending on the value of a checkbox:
Above works great.Code:$(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(); });
However, I also need to SHOW the form input if a returned database value matches 1 as well.
PHP Code: [Select]
Code:if ($gtprsn['usr_type'] == 1); { ... show the freaking text input ... }
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 Code: [Select]
Code:<?php if ($gtprsn['usr_type'] == 3): ?>style="display:block !important;"<?php endif; ?>
But this then overrides the jquery and if I check the other radio button (value 2), the input still shows...
Suggestions?


Reply With Quote



Bookmarks