Bug Tracker

Opened 6 years ago

Closed 6 years ago

#13920 closed bug (duplicate)

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/

Change History (1)

comment:1 Changed 6 years ago by m_gol

Resolution: duplicate
Status: newclosed

Duplicate of #13245.

Note: See TracTickets for help on using tickets.