You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
Retrieve the content for any OPTION elements when the value of the selected attribute equals
selected.
Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a
complete solution. Choose two.)
A.
Option A
B.
Option B
C.
Option C
D.
Option D
E.
Option E
Explanation:
Note:
* select option:selected
:selected Selector
Description: Selects all elements that are selected.
Correct answer: CD
the correct answers are: CD
I agree with the above posts.
The correct answers are C and D.
Agree To CD
Because $(loanTypes).test() return all HTML inside select tag
Correct are C and D.
C =>
1: (“select option:selected”) selects all option-elements with an selected attribute(value) in an select-elements.
2: $(this).text() Receives the text from this option element.
Where $(loanTypes).text() returns all of the HTML inside select-element with the id loanTypes.
D =>
1: (“#loanTypes option:selected”) selects all option-elements with an selected attribute(value) in an element with id=”loanTypes”.
2: $(this).text() Receives the text from this option element.
Where $(loanTypes).text() returns all of the HTML inside select-element with the id loanTypes.
CD