2 Replies Latest reply on Aug 6, 2013 8:11 AM by chino_10

    How to change the content of a text input?

    chino_10

      Hi!

      I would like to help me with the following

       

      I've create and input text, for example this:

       

      var one= sym.$("one")

      one.html("Enter your answer: ");

      inputOne = $('<input />').attr({'type':'text', 'value':'', 'id':'one'});

      inputOne .css ('font-size', 14);

      inputOne .css ('width', 350);

      inputOne .css ('background-color', '#0a81fb');

      inputOne .appendTo(one);

       

      Now the user can write anything in this input text.

       

      The corret word that the user has to write is "correct"

      so i use an if to validate it

       

      if (inputOne.val() == "correct"){

           alert ("good")

      }else {

             // HERE IS MY PROBLEM!!!   What i need to do is: if the user types a wrong answer i           //need to show him the correct answer in the input text.

      }

       

       

      I hope you can help me.

       

       

      Thank's =)