Maybe someone could shed some light on this. When inserting an item into 
a select box (id=test), this code works:

var optn = document.createElement("OPTION");
optn.text = $(this).find('nome').text();
optn.value = $(this).find('id').text();
$( "#test" ).append(optn);
                                
But this code does not:                 

$( "<option value='" +  $(this).find('id').text() + "'>" + 
$(this).find('nome').text(); + "</option>" ).appendTo( "#test" ) ;

Even this very simplistic example doesn't work.

$( "<option value='1'>foo</option>" ).appendTo( "#test" ) ;                     

I remember John Resig telling me that I can create elements on the fly 
by using syntax similar to this;

$( "<option value='1'>foo</option>" ).appendTo( "#test" ) ;

so I'm not clear why its not working.

Any help would be appreciated.

Rey...

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to