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?
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’});
the answer is D,check here http://www.w3schools.com/cssref/sel_attr_end.asp
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