Dhruva Sagar wrote:
Where have you added the $('#another').click() ?
Is it even in $(document).ready() or not ? Are you sure that the click
handler is even being called ?

I have created a test.html and tested what you want, it works perfectly for
me.

<html>
  <head>
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.pack.js";
type="text/javascript" language="javascript" charset="utf-8"></script>
    <script type="text/javascript" language="javascript" charset="utf-8">
      // <![CDATA[
        $(document).ready(function() {
            $('#another').click(function() {
              $('#word').after('<label for="word2"></label><input
type="text" name="word2" id="word2" value="" size="50" />');
            });
        });
        // ]]>
      </script>
  </head>
  <body>
    <label for="word">Texto:</label>
    <input type="text" name="word" id="word" value="" size="50" />
    <a href="#" id="another">Adicionar criterio</a>
  </body>
</html>

Thanks & Regards,
Dhruva Sagar.


Ohh I see my mistake now I forget to write this code inside $().ready() for that it wont work. Now I have a second question: how I can generate dinamically the number for element input id? I mean every time I click the link the id will be incremented in one so will be: word1, word2, wordn
Thanks
--
Saludos
ReynierPM

Reply via email to