I have:
var outcome = $('#outcome') ;
With one outcome "#outcome" but i want to have two outcomes
i have tried
var outcome = $('#outcome #outcome2') ;
I have:
var outcome = $('#outcome') ;
With one outcome "#outcome" but i want to have two outcomes
i have tried
var outcome = $('#outcome #outcome2') ;
Separate the selectors with a comma:
var outcome = $('#outcome, #outcome2');
What you currently have is looking for an element matching #outcome2
that is a descendant of an element matching #outcome
.
This is documented under "multiple selector" in the jQuery API. As noted on that page, an alternative is to use the add
method (but I would definitely recommend sticking with the multiple selector in this case):
var outcome = $('#outcome').add('#outcome2');