0

I am having a aspx page,in which there is a Select box control

<select name="selViewPerPage" id="selViewPerPage" style="width:30px">

In order to bring a particular style in all browsers, i am replacing this html control with dynamic select box using "selectBox.js" . Now the problem is , i am having two dropdowns in the page ,during runtime they are generated with same class name without any ids.So while trying to position the controls using css,the both drop downs takes the same position. Please see the html code in firebug

So i am not sure ,how to handle this situation .Please let me know,if you need more information.

Thnks

2 Answers 2

1

Try using a pseudo-selector to get just a specific item, such as the first, last, or nth item. See :eq() or :first() or :last() for example: http://api.jquery.com/category/selectors/. Using one of those sorts of selectors, you can get just the element you want to modify and apply styles to it individually. Ex.

$('ul').first()

or

$('ul:last')

or

$('ul').eq(1)

Or some other variant of these.

Sign up to request clarification or add additional context in comments.

Comments

1

If you have multiple instances of items with the same class, use the .eq() selector.

$('.someSelect').eq(0) <-- first instance
$('.someSelect').eq(1) <-- second instance

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.