javascript - Not able to append options to select -


I'm not sure why this works, but when I pass in numbers

  & lt; Form ID = "Form 1" Runat = "Server" & gt; & Lt; Div id = "facebook photo-iframe content" & gt; & Lt; Div & gt; & Lt; P & gt; Sign in & lt; / P & gt; & Lt; P id = "LoginButtonContainer" & gt; Input  & Lt; / P & gt; & Lt; P & gt; & Lt; Select ID = "facebookAlbumDropdown" /> & Lt; / P & gt; & Lt; Div id = "facebook photocontainer" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt;  

  AddDropdownItem ("- test a few - select", "-1", "testDropdown"); Function AddDropdownItem (sText, sValue, sDropdownID) {$ ("#" + sDropdownID) .append ("& lt; Option Value =" + sValue + "& gt;" + steext + "& lt; / Options & gt;) ;}  

This works

but it is not:

  var id = 104388426283811; AddDropdownItem ("- some Select the test- "id.toString ()," testDropdown ");  

What is the default option appears, but then when it tries to add another option So he creates a bomb with no errors which I can see in the firebug console and then the end The list is empty (no choice) when my code is to be run.

In the original Question based on the comment thread, this is my sample page that includes your argument (with a button wiring to add options for selection):

  & lt; Html xmlns = "http://www.w3.org/1999/xhtml">  gt; meta http-equiv = "content-type" content = "text / html; Charset = UTF-8 "/> gt; Title & gt; jQuery test & lt; / title & gt; script type =" text / javascript "src =" http://code.jquery.com /jquery-1.4.2.min.js "> 



  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -