PrepAway - Latest Free Exam Questions & Answers

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

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-]-) .css ({ background-color : #E0ECF8}) ;

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

C. ${input[name=-*name-]).css({background=color: #E0ECF8});

D. $( input [name=-$name-] ) .css ({ background-color : #E0ECF8});

Explanation:

The string pattern -*name- matches all strings that ends with name.

3 Comments on “You develop an HTML5 webpage. You have the following HTML markup:

    1. _mr says:

      Yes, you are right except there are another three errors I think. If I am correct the ‘$’ sign should be before ‘=’, and not after. Another error is that there cannot be space between ‘input’ and attribute name. The last one is missing quotes (“”) or apostrophes (”) which should surround the whole selector in that case.

      So I think that the correct answer is D but in the end it should look like one of the following options:

      $(“input[name$=’name’]”).css(“background-color”, “#E0ECF8″);
      $(‘input[name$=”name”]’).css(“background-color”, “#E0ECF8”);
      $(“input[name$=name]”).css(“background-color”, “#E0ECF8”);
      $(‘input[name$=name]’).css(“background-color”, “#E0ECF8”);

      The only optional thing in the above lines are inner apostrophes/quotes that surround the name phrase. They are only for readability sake but without them works as well.




      0



      0

Leave a Reply