Opened 12 years ago
Closed 12 years ago
#7953 closed bug (invalid)
Bug in Jquery Mobile Select Menu
Reported by: | gurviner372 | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | unfiled | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I am using Jquery Mobile version jquery.mobile-1.0a2.min.js and Jquery Version jquery-1.4.3.min.js
If i add the select box control (as a text html) dynamically to the screen while using JQuery Mobile, then it gives me following error
TypeError: Result of expression 'd[0].options' [undefined] is not an object.
This is the code that i used
<script> $(document).ready(function(){ addComboBox(); }); function addComboBox() { var contentHTML = ""; contentHTML += "<div data-role='fieldcontain'>"; contentHTML += "<label for='categories' class='select'></label>"; contentHTML += "<select id='categories' name='categories'>"; //contentHTML += "<optgroup label='TEXT.SHPLST_LI_SL'>"; contentHTML += "<option value ='_allSavedItems'>"; contentHTML += "TEXT.SHPLST_LI_ALL_ITEMS"; contentHTML += "</option>"; for (var i=0; i < 10; i++) { contentHTML += "<option value ='" + i + "'>"; contentHTML += i; contentHTML += "</option>"; } //contentHTML += "</optgroup>"; contentHTML += "</select></div>"; $("#toolbar").append( contentHTML ).selectmenu(); } </script>
Note: See
TracTickets for help on using
tickets.
Thanks for taking the time to contribute to the jQuery project by writing a bug report.
Unfortunately this bug tracker is only for bugs in jQuery core.
jQuery Mobile bugs should be filed on the jQuery Mobile bug tracker as they will be able to assist you further with this. Please re-submit your bug ticket there.
Btw. I guess there isn't really a bug here, the error probably is raised because you call the
selectmenu()
method on the#toolbar
div instead of the actualselect
. Try replacing the last line withP.S.: jQuery Mobile 1.0 Alpha 2 requires jQuery 1.4.4 not 1.4.3