0

How get all selected values (not empty) for all selects in document using Prototype dollar dollar function $$() ?

Thanks, Celso

1
  • 1
    How do you define "empty"? The option does or doesn't have a value? The option does or doesn't have text content? It would be helpful if you posted your HTML. Commented Jul 6, 2011 at 19:51

2 Answers 2

4

I don't know what your definition of "empty" is.

This needs to be known because most browsers will look at the value attribute as well as the text content of the option.

Assuming that there is a value attribute that has been set to an empty string, or there's no value and no text content, then you could do this:

var result = $$('select').invoke('getValue').without('');
Sign up to request clarification or add additional context in comments.

Comments

-1

One reason I switched to jQuery is that it is a lot easier to handle these situations.

You may need do it the hard way in Prototype:

$$('...').each(function(element) {
    if(element.innerHTML=='') {
        // your operation
    }

})

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.