jQuery: The Write Less, Do More JavaScript Library

Ticket #3223 (closed bug: invalid)

Opened 2 weeks ago

Last modified 5 days ago

Problems with select box append

Reported by: ipr101 Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.3 Component: core
Version: 1.2.6 Keywords:
Cc: Needs: Review

Description

I have created an html page (attached) that contains two list boxes. On selecting an element in the top list box and clicking the 'test' button an element is moved to the bottom listbox. The following code is then run to select the bottom option in the lower listbox -

document.getElementById('bSelect').options[document.getElementById('bSelect').options.length-1].selected = 'true';

In IE7 the element is not selected as requested, the code works as expected within Firefox.

Attachments

lb.htm (3.6 kB) - added by ipr101 2 weeks ago.

Change History

Changed 2 weeks ago by ipr101

Changed 2 weeks ago by ipr101

Sorry - the description is not clear. The last sentence should read -

In IE7 the element is selected as requested but the listbox does not scroll down to reveal the selected element. The code works as expected within Firefox.

Changed 6 days ago by nathanhammond

I've reviewed your test case. The problem you're describing is a user-agent difference in how they adjust the scroll position of a <select> that has had an option element selected programmatically. It is successfully selecting the element in IE7 but by user-agent decision, it doesn't adjust which options are visible. This is not a jQuery bug, nor is it a bug in IE.

Ariel, this ticket can be closed as invalid.

Changed 5 days ago by ipr101

Thanks for your feedback. If I remove the jquery append call from the javascript function, then IE will select the bottom selectbox element and scroll the select box position so the selected box is visible. This is what lead me to believe it was jquery bug, as IE's behaviour appaers to change after the jquery append call is made.

Changed 5 days ago by john

  • status changed from new to closed
  • resolution set to invalid
Note: See TracTickets for help on using tickets.