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 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2008
    Location
    NEW YOrk
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation Urgent ! How to Enable a text field only when user enter 10 number ?

    Hello -
    I want to create a text field and next to it are two text fields.
    Only when the user enter 10 number, the two text fields should get enabled.

    How to do this?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,309
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Code:
    <input type = "text" id = "number10" size = "6" onblur = "chk10()"><br>
    <input type = "text" id = "txt1" size = "6" disabled><br>
    <input type = "text" id = "txt2" size = "6" disabled><br>
    
    <script type = "text/javascript">
    
    function chk10() {
    var x = document.getElementById("number10").value;
    if (x == 10) {
    document.getElementById("txt1").disabled = false;
    document.getElementById("txt2").disabled = false;
    }
    else {
    document.getElementById("txt1").disabled = true;
    document.getElementById("txt2").disabled = true;
    }
    }
    </script>

    i raed a wlihe ago taht as lnog as the frsit and lsat lttesrs in a wrod are in the cerroct pcale msot of us wulod siltl be albe to raed bceause our barnis jsut looks at the frsit and lsat lttesrs.

  • #3
    New Coder
    Join Date
    Apr 2008
    Location
    NEW YOrk
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I copy and paste but.. is no working :O(

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,309
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by liccy View Post
    I copy and paste but.. is no working :O(
    Well, it works fine for me.

  • Users who have thanked Philip M for this post:

    liccy (07-29-2008)

  • #5
    New Coder
    Join Date
    Apr 2008
    Location
    NEW YOrk
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    my bad I missed something.. Thx


  •  

    Posting Permissions

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