You should be doing $('#word').after('<label for="word2"></label><input
type="text" name="word2" id="word2" value="" size="50" />');

append() would add your HTML code as a child of that input, hence you will
not get the desired results.

Thanks & Regards,
Dhruva Sagar.


Pablo Picasso<http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html>
- "Computers are useless. They can only give you answers."

On Tue, Nov 3, 2009 at 8:44 AM, ReynierPM <rper...@uci.cu> wrote:

> Hi every:
> I need to add some fields when a user clic a link. For this purpose I build
> this piece of code:
>
> [jQuery/JS Code]
> $('#another').click(function(){
>  $('#word').append('<label for="word2"></label><input type="text"
> name="word2" id="word2" value="" size="50" />');
> });
>
> [HTML Code]
> <label for="word">Texto:</label>
> <input type="text" name="word" id="word" value="" size="50" /> <a href="#"
> id="another">Adicionar criterio</a>
>
> But for some reason when I click the link it doesn't work. Can any help me
> to fix this?
> --
> Cheers
> ReynierPM
>

Reply via email to