1

I'm generating a options elements for select el. And after document ready, I need do each() for all this elements. How can I do this?

ps I know how select this elements after some events, live(). But now, it's impossible.

5
  • They too big, 1.5k mixed js ;-( Commented Jan 24, 2012 at 10:49
  • Can you describe your problem in minimum codes? Commented Jan 24, 2012 at 10:51
  • Wait few minutes, I'm try on JSFiddle Commented Jan 24, 2012 at 10:53
  • I'm sorry, I just don't get what you want to do? When are you generating the options element? Commented Jan 24, 2012 at 11:05
  • Florian: After generating, I'm check data-role attr on do some magic. Commented Jan 24, 2012 at 11:11

2 Answers 2

1

you mean something like this ?

$(document).ready(function()
{
    $('#id-select').find('option').each(function()
    {
        // do something with option - saved as $(this)
    });
});
Sign up to request clarification or add additional context in comments.

Comments

1

You can try this script

$('#myselect option').each(function(){
   alert($(this).val());// option element 
});

http://jsfiddle.net/gJeGK/

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.