2016-06-24 3 views
0
<script type="text/javascript" language="javascript"> 
function enabletxt(){ 
    document.getElementById("chkAssociation").innerHTML="<input type='text' value=''>" 
} 
</script> 
Hobbies: <input type="checkbox" name="hobbies" value="Dancing">Dancing 
<input type="checkbox" name="hobbies" value="Painting">Painting 
<input type="checkbox" name="hobbies" value="Others" onChange="javascript:enabletxt();" ID="chkAssociation" runat="server" />Others 
+1

텍스트 숨기기를 취소/자바 스크립트 또는 JQuery와 숨기기를 할 쓰기 – Prathyush

답변

0

당신이 할 수있는 무엇 :

function enableText(checkBox) { 
    if (checkBox.nextSibling.tagName != 'INPUT') { 
     var input = document.createElement('input'); 
     input.type = "text"; 
     checkBox.parentNode.insertBefore(input, checkBox.nextSibling); 
    } 
} 

<input type="checkbox" name="hobbies" value="Dancing" onchange="enableText(this)"> 
0
<input type="checkbox" name="hobbies" value="Dancing">Dancing 
    <input type="checkbox" name="hobbies" value="Painting">Painting 
    <input type="checkbox" name="hobbies" value="Others" onclick="OnChangeCheckbox (this)"ID="chkAssociation"/>Others 
    <input type="textbox" Id="txtToggle" style="display:none"/> 
    <script type="text/javascript"> 
    function OnChangeCheckbox (checkbox) { 
     if (checkbox.checked) { 
      document.getElementById('txtToggle').style.display="block"; 
     } 
     else { 
      document.getElementById('txtToggle').style.display="none"; 
     } 
    } 
    </script> 
0

이 당신이 찾고있는 무엇인가?

<script type="text/javascript"> 
    function toggleOtherTextboxVisible() 
    { 
     var check = document.getElementById('OtherCheckBox'); 
     if (check.checked) { 
      document.getElementById('OtherTextBox').style.display = 'block'; 
     } 
     else 
      document.getElementById('OtherTextBox').style.display = 'none';     
    } 
</script> 
<div> 

    <input id="OtherCheckBox" type="checkbox" value="Others" onchange="javascript:toggleOtherTextboxVisible()" />Others 
    <input id="OtherTextBox" type="text" style="display:none" /> 

</div> 
0
<script type="text/javascript"> 
     function enabletxt(){ 
     if(document.getElementById('chkAssociation').checked) { 
      $('#chkAssociation2').html('<input type="text" value="">'); 
     }else{ 
      $('#chkAssociation2').html(''); 
     } 
     } 
    </script> 
    <input type="checkbox" name="hobbies" value="Dancing">Dancing 
    <input type="checkbox" name="hobbies" value="Painting">Painting 
    <input type="checkbox" name="hobbies" value="Others" onChange="javascript:enabletxt();" ID="chkAssociation" runat="server" />Others 
    <div id= "chkAssociation2"></div> 
관련 문제