PrepAway - Latest Free Exam Questions & Answers

Which two code segments should you add to the webpage?

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.)

PrepAway - Latest Free Exam Questions & Answers

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.

6 Comments on “Which two code segments should you add to the webpage?

  1. Firefox360 says:

    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.




    0



    0

Leave a Reply