javascript - toogle in jquery, change divs but if statement not work -
im working on this, im trying show 1 div @ time cant make divs change show 1 option:
$(document).ready(function(){ $("#boton1").click(function () { $('#tdecredito').toggle("slow"); }); $("#boton3").click(function () { $('#tdecredito').toggle("slow"); }); $("#boton2").click(function () { $('#deposito').toggle("slow"); }); $("#boton4").click(function () { $('#deposito').toggle("slow"); }); var isvisible = $( "#tdecredito" ).is( ":visible" ); var ishidden = $( "#tdecredito" ).is( ":hidden" ); var isvisibleb = $( "#deposito" ).is( ":visibleb" ); var ishiddenb = $( "#deposito" ).is( ":hiddenb" ); if($('#tdecredito').is(":visible")) { $('#deposito').hide(":hiddenb"); } else($('#deposito').is(":visibleb")) { $('#tdecredito').hide(":hidden"); } }); test page:test page
i don't know why need 4 buttons , why need visible part. here 1 solution http://jsfiddle.net/x3fcx/2/.
simply start 1 hidden element, , click buttons, both of divs toggled, meaning, 1 visible gets hidden , 1 hidden gets visible.
$(document).ready(function(){ $("#boton1").click(function () { $('#tdecredito').toggle("slow"); $('#deposito').toggle("slow"); }); $("#boton3").click(function () { $('#tdecredito').toggle("slow"); $('#deposito').toggle("slow"); }); $("#boton2").click(function () { $('#tdecredito').toggle("slow"); $('#deposito').toggle("slow"); }); $("#boton4").click(function () { $('#tdecredito').toggle("slow"); $('#deposito').toggle("slow"); }); $('#deposito').hide(); });
Comments
Post a Comment