#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Why dont this work


    the problem is the button dose not change to the text which is entered in the text box


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Send message</title> <script> changeButton(){ $("#button1").text($("#username").vale); } </script> </head> <body> <form action="?op=login" id="theform" method="POST"> <fieldset> <legend>Login</legend> Username: <input name="username" type="text" id="name" onkeyup="changeButton()" size="15" /><br /> Password: <input id="message" type="text" name="password" size="8"><br /> <button id="button1">Send Message</button>​ </fieldset> </form> </body> </html>
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    I can barely read that, but I guess

    Code:
    $("#username").vale
    should be "value". Check the JavaScript console of your browser to debug your scripts. It will display all errors and other info.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0
    came up with this error

    Uncaught SyntaxError: Unexpected token { private-mess.php:7

    Uncaught ReferenceError: changeButton is not defined private-mess.php:17



    this is a clearer version


    Code:
    <script type="text/javascript">
      changeButton(){
        $("#button1").text($("#username").value);
    }
      </script>
    </head>
    <body>
     
    <form action="?op=login" id="theform" method="POST">
      <fieldset>
      <legend>Login</legend>
    Username: <input name="username" type="text" id="name" onkeyup="changeButton()" size="15" /><br />
    Password:  <input id="message" type="text"  name="password" size="8"><br />
        <button id="button1">Send Message</button>&#8203;
            </fieldset>
       </form>
  6. #4
  7. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Code:
    function changeButton(){
        $("#button1").text($("#username").value);
    }
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.

IMN logo majestic logo threadwatch logo seochat tools logo