Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2011
    Posts
    131
    Thanks
    11
    Thanked 0 Times in 0 Posts

    need help with a simple div hide script

    Code:
    <script type="text/javascript">
    function toggleVisibility4(controlId)
    {
    
    var z = document.forms["frm_sms"]["phone"].value;
    
    var minimumnum = 10;
    
    var control = document.getElementById(controlId);
    
    
    
    
    
    if (z.length <= minimumnum)
      {
    
    control.style.visibility = "visible";
    
    
    
      }
    else
    
      {
    control.style.visibility = "hidden";
    }
    
    </script>
    im not sure where im going wrong
    i am calling this script from a " onkeyup="toggleVisibility4('arrow')" "

    the arrow is a div i am wanting to hide when the input field "phone" on a form id of "frm_sms" has more than 10 characters
    any ideas guys

  • #2
    Regular Coder
    Join Date
    Nov 2011
    Posts
    131
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gerble1000 View Post
    Code:
    <script type="text/javascript">
    function toggleVisibility4(controlId)
    {
    
    var z = document.forms["frm_sms"]["phone"].value;
    
    var minimumnum = 10;
    
    var control = document.getElementById(controlId);
    
    
    
    
    
    if (z.length <= minimumnum)
      {
    
    control.style.visibility = "visible";
    
    
    
      }
    else
    
      {
    control.style.visibility = "hidden";
    }
    
    </script>
    im not sure where im going wrong
    i am calling this script from a " onkeyup="toggleVisibility4('arrow')" "

    the arrow is a div i am wanting to hide when the input field "phone" on a form id of "frm_sms" has more than 10 characters
    any ideas guys
    doesnt matter i figured it out

    i changed the lot to this
    Code:
    <script type="text/javascript">
    function toggleVisibility4(controlId)
    {
    
    var z = document.forms["frm_sms"]["phone"].value;
    
    var minimumnum = 10;
    
    var control = document.getElementById(controlId);
    
    
    
    
    
    if (z.length <= minimumnum)
    control.style.visibility = "visible";
    
    
    
    
    else
    control.style.visibility = "hidden";
    
    }
    </script>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •