Bug Tracker

Modify

Ticket #7953 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

Bug in Jquery Mobile Select Menu

Reported by: gurviner372 Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocking: Blocked by:

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>

Change History

comment:1 Changed 2 years ago by jitter

  • Status changed from new to closed
  • Resolution set to invalid

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 actual select. Try replacing the last line with

$("#toolbar").append( contentHTML )
$("#categories").selectmenu();

P.S.: jQuery Mobile 1.0 Alpha 2 requires jQuery 1.4.4 not 1.4.3

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.