Rey Bango schrieb:
> 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.
>   
AFAIK the $("<div>") expression parses the string, detects the pointy 
brackets, parses the content ("div") and creates the element by using 
document.createElement, in this case with "div" as the argument. Just 
try document.createElement("div id='xxx'") and you should see why it 
doesn't work.
This is the fault of something called 'leak of abstraction'. jQuery 
hides a lot of implementation stuff, which is good for quickly 
prototyping stuff, but bad when it comes to problems like this. I 
created a bug report: http://jquery.com/dev/bugs/bug/218/

I hope that helps.

-- Jörn

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

Reply via email to