Skip to main content

Bug Tracker

Side navigation

#13920 closed bug (duplicate)

Opened May 22, 2013 12:46PM UTC

Closed May 22, 2013 01:51PM UTC

Select nth-child problem in chrome

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description

I am using jQuery Version 1.9.1.

I have following code blocks.

HTML:

<select>
    <option value="a">a</option>
    <option value="b" selected="selected">B</option>
    <option value="c">C</option>
    <option value="d">d</option>
    <option value="e">e</option>
    <option value="f">f</option>
    <option value="g">g</option>
</select>
<button id="btn">Click me</button>

jQuery:

$('#btn').click(function(){
    alert($('select option:selected').text());
    $('select>option:selected').removeAttr('selected');
    $('select>option:nth-child(4)').attr('selected', true);
    alert($('select option:selected').text());
});

The above code works well in firefox but doesn't work in chrome. But with jQuery version < 1.9.1, it works well in all browser. please see this in http://jsfiddle.net/8m8X3/

Attachments (0)
Change History (1)

Changed May 22, 2013 01:51PM UTC by m_gol comment:1

resolution: → duplicate
status: newclosed

Duplicate of #13245.