I have a small script,with very straight function. If the checkbox is not checked, if the user clicked on it show a div otherwise hide the div when user clicks in it. The script is (its inside a PHP code ):
echo
'<script>
$(document).ready(function(){
if($("#chk_id'.$bank_name.'").is(":checked"))
{
$("#chk_id'.$bank_name.'").click(function(){
$("#form_show'.$bank_name.'").hide(300);
});
}
else
{
$("#chk_id'.$bank_name.'").click(function(){
//alert("ddd");
$("#form_show'.$bank_name.'").show(300);
});
}
});
</script>';
But the problem is although the show div is working, I am unable to hide the div ! Whats wrong?
javascript library : <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>