How to display the div on click radio button yes or not used javascript

HTML, PHP 0 Comments

How to display the div on click radio button yes or not used javascript
onclick hide and show the div box on click radio button

Expalin how to show div onclick radio button
document.getElementById(‘yesCheck2’).checked)

Function of this code is pass the id name same in input tag type “yesCheck2″

for example element id=”yesCheck2″

<input type=”radio” onclick=”javascript:yesnoCheck4();” name=”yesno” id=”yesCheck2″>

Function of this code Onclick show div by id and style=”display:none”

document.getElementById(‘ifYes2’).style.display = ‘block’;
<div id=”ifYes2″ style=”display:none”> </div>

Javascript Code 

<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
 <script type="text/javascript">

function yesnoCheck4() {
 if (document.getElementById('yesCheck2').checked) {
 document.getElementById('ifYes2').style.display = 'block';
 }
 else document.getElementById('ifYes2').style.display = 'none';

}

function yesnoCheck2() {
 if (document.getElementById('yesCheck1').checked) {
 document.getElementById('ifYes1').style.display = 'block';
 }
 else document.getElementById('ifYes1').style.display = 'none';

}

</script>

 

HTML Code 

Yes <input type="radio" onclick="javascript:yesnoCheck4();" name="yesno" id="yesCheck2">
 No <input type="radio" onclick="javascript:yesnoCheck4();" name="yesno" id="noCheck2"><br>
 <div id="ifYes2" style="display:none">
 Open the input box in div on click radio button <input type='text' id='yes' name='yes'><br>
 Open the input box in div on click radio button <input type='text' id='acc' name='acc'>
 </div>

Yes <input type="radio" onclick="javascript:yesnoCheck2();" name="yesno1" id="yesCheck1">
 No <input type="radio" onclick="javascript:yesnoCheck2();" name="yesno1" id="noCheck1"><br>
 <div id="ifYes1" style="display:none">
 Open the 2nd input box in div on click radio button <input type='text' id='yes' name='yes1'><br>
 Open the 2nd input box in div on click radio button <input type='text' id='acc' name='acc1'>
 </div>

 

onclick radio button show show div
onclick radio button show show div

 

 

 


Bank PO clerk, SSC, Railway (RRB), IBPS, UPSC, IAS, RAS, SBI, 1st 2nd 3rd grade teacher,REET, TET, Rajasthan police SI, Delhi police, के महत्वपूर्ण सवाल जवाब के लिए रजिस्टर करे
आप करेंट अफेयर्स, Job, सामन्य ज्ञान ओर सभी exams संबंधित Study Material की जानकारी हैतु इस पेज को Like and Visit करे
https://www.facebook.com/myshort.Trick
and WWW.myshort.in

share..Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0