Show / Hide contents base on radio button selection
<p>I am trying to toggle a content DIV base on the selection of radio buttons.</p><p>HTML for radio button.</p><pre><br /><code><div class="row-fluid"><br /> <label class="radio"><br /> <input type="radio" name="account" id="yes" value="yes" checked><br /> Yes, I have an existing account<br /> </label><br /> <label class="radio"><br /> <input type="radio" name="account" id="no" value="no"><br /> No, I don't have an account<br /> </label><br /></div><br /></code><br /></pre><p>Content DIV</p><pre><br /><code><div id="account_contents"><br /> <p>This is account contents.......</p> <br /></div><br /></code><br /></pre><p>This is how I tried it in jquery.</p><pre><br /><code>$('#no').bind('change',function(){<br /> $('#account_contents').fadeToggle(!$(this).is(':checked'));<br /> $('#account_contents').find("input").val("");<br /> $('#account_contents').find('select option:first').prop('selected',true);<br />});<br /></code><br /></pre><p>But it doesn't work for me correctly. Here I want to show this content DIV only if user don't have an account.</p><p>Can anybody tell me how to fix this problem?</p><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34469807/show-hide-contents-base-on-radio-button-selection">http://ift.tt/1mFkFsN</a></h2>
Nhận xét
Đăng nhận xét