PrepAway - Latest Free Exam Questions & Answers

Which code segment should you add to the webpage?

You develop an HTML5 webpage. You have the following HTML markup:

You need to change the background color for all of the elements whose name attribute ends with
the word name.
Which code segment should you add to the webpage?

PrepAway - Latest Free Exam Questions & Answers

A.
$ (‘input [name!=”name”]’) .ess ({ ‘background-color’ : ‘ #E0ECF8’}) ;

B.
${‘input [name~=”name”] ‘) .ess ({ ‘background-color’ : ‘ #E0ECF8’ }) ;

C.
${‘input[name*=”name”]’).ess({‘background=color’: #E0ECF8′});

D.
$( ‘input [name$=”name”] ‘) .ess ({ ‘background-color’ : ‘#E0ECF8’});

2 Comments on “Which code segment should you add to the webpage?

  1. Firefox360 says:

    Answer is D.
    ^ will be used for selecting elements which name attribute value starts with “name”.
    $ will be used for selecting elements which name attribute value ends with “name”.
    * will be used for selecting elements which name attribute has “name” within its value.

    ~ and ! will not be used in this way, so they are wrong answers by default.
    A~B selects all B that follows an A (ABBB will return BBB)
    ! is an NOT-operator

    Check for more info: http://www.w3schools.com/cssref/sel_attr_end.asp




    2



    0

Leave a Reply