exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

Exam 70-480 topic 4 question 3 discussion

Actual exam question from Microsoft's 70-480
Question #: 3
Topic #: 4
[All 70-480 Questions]

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'});
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
The string pattern "*name" matches all strings that ends with name.

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Shapespacer
Highly Voted 5 years, 4 months ago
typo on answer should be $('input[name$="name"]').css...
upvoted 10 times
...
Sanfour
Highly Voted 4 years, 11 months ago
I think the answer should be D when it like $( 'input [name$="name"] ') .css ({ 'background-color' : '#E0ECF8'});
upvoted 6 times
...
PHULU
Most Recent 4 years, 7 months ago
D should be the correct answer cause Dollar sign specified the attribute value End with specified text
upvoted 2 times
...
KyryIx
5 years, 2 months ago
<!DOCTYPE html> <html lang="en"> <head> <title></title> <meta charset="utf-8"/> <script src="./jquery-3.4.1.js"></script> <script> window.onload = function(){ // *= Specifies that the attribute has a value CONTAINING the specified text. $('input[name*="name"]').css('background-color', '#E0ECF8'); // $= Specifies that the attribute has a value ENDING with the specified text. $('input[name$="name"]').css('background-color', '#EFECF8'); } </script> </head> <body> <label for="personname">Given and Surname:</label> <input type="text" name="personname"/><br/> <label for="businessname">Business Name:</label> <input type="text" name="businessname"/><br/> <label for="emailaddress">Email Address:</label> <input type="text" name="emailaddress"/> </body> </html>
upvoted 6 times
mart123
5 years ago
https://jsfiddle.net/0vpq9523/
upvoted 2 times
nelaed
4 years, 9 months ago
thanks man.
upvoted 1 times
...
...
...
SGT
5 years, 8 months ago
C. ${'input[name="*name"]').css({'background=color': #E0ECF8'}); change 'background=color' to 'background-color'
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago