How do I set a "hide/show" to hide without 'onchange'?
Posted: Tue Nov 12, 2013 6:14 am
This is the part of my code that I need altering some how.
This works for our Sell page, as they choose a type, and based on that selection, a box appears with further options.
However, on the Edit page, if they have pre-chosen the type that would have shown the additional box, I want that box to show straight away. but if the Type is NOT the option to make the box show, then it shouldn't.
This works for our Sell page, as they choose a type, and based on that selection, a box appears with further options.
However, on the Edit page, if they have pre-chosen the type that would have shown the additional box, I want that box to show straight away. but if the Type is NOT the option to make the box show, then it shouldn't.
Code: Select all
<style>
#send_to_one{display:none;}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#send_to_one").hide();
$("input:radio[name='guntype']").change(function(){
if(this.value == 'Special Version' && this.checked){
$("#send_to_one").show();
}else{
$("#send_to_one").hide();
}
});
});
</script>
<input type='radio' id='send_poll1' name='guntype' value='Normal Version' ";
if ($row->stype == "Normal Version") { echo " checked";}
echo " /><label for='send_poll1'>Normal Version</label><br/>
<input type='radio' id='send_poll2' name='guntype' value='Special Version'' ";
if ($row->stype == "Special Version") { echo " checked";}
echo " /><label for='send_poll2'>Special Version</label><br/>