vivekam8 Posted April 27, 2012 Share Posted April 27, 2012 I am very new to jquery and ajax. While googling (i wonder if "googling" is a dictionary word!!) for some code which enables to toggle between two divs using radio buttons, I stumbled upon this code. It is not working but I feel it is very close to being correct!! Can someone help me to correct this? Thanks in advance Your fan! <html> <head> <script type="text/javascript"> $(function() { $("[name=toggler]").click(function(){ $('.toHide').hide(); $("#blk-"+$(this).val()).show('slow'); }); }); </script> </head> <body> <label><input id="rdb1" type="radio" name="toggler" value="1" />Money</label> <label><input id="rdb2" type="radio" name="toggler" value="2" />Interest</label> <div id="blk-1" class="toHide" style="display:none"> money </div> <div id="blk-2" class="toHide" style="display:none"> interest </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/261680-toggle-a-div-using-radio-buttons/ Share on other sites More sharing options...
requinix Posted April 27, 2012 Share Posted April 27, 2012 Are you including the jQuery library somewhere? It's not in the code you posted. Quote i wonder if "googling" is a dictionary word!! Yep. Link to comment https://forums.phpfreaks.com/topic/261680-toggle-a-div-using-radio-buttons/#findComment-1341008 Share on other sites More sharing options...
trq Posted April 27, 2012 Share Posted April 27, 2012 While your googling things, you should google *ajax* as your code doesn't use any at all. Link to comment https://forums.phpfreaks.com/topic/261680-toggle-a-div-using-radio-buttons/#findComment-1341081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.