Robert Granlund
asked on
PHP Sticky For to pass variable to JQuery
I want to pass a php form sticky entry to Jquery upon page refresh.
PHP Code:
()
So since this radio button is already "Checked" I want the div to automatically show.
But, the following does not work:
PHP Code:
function choose_registration_type() {
echo ' <h4>I Would Like To:</h4><br />
<input type="radio" name="team_join" id="create_new_team" value="Create New Team" />Create New Team<br />
<input type="radio" name="team_join" id="join_existing_team" value="Join Existing Team"'; if(isset($_POST['team_join']) && $_POST['team_join'] == "Join Existing Team") {echo'checked';} echo'/>Join Existing Team<br />
<input type="radio" name="team_join" id="join_individually" value="Join Individually" />Join Individually';
}
So if the form fails, the radio button is still chosen. However, this is within a div that is shown/hidden by JQuery with a $(document).ready(functionSo since this radio button is already "Checked" I want the div to automatically show.
But, the following does not work:
$(document).ready(function() {
$('input[type="radio"]').checked(function() {
if ($(this).attr("value") == "Join Existing Team") {
$("#join_group").show('fast');
}
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or this? http://jsfiddle.net/6U9SY/2/
...if the form fails, the radio button is still chosenWhat do you mean by if the form fails?
ASKER
This was exactly what I needed. I'm slowly learning JQuery and this helped!