PrepAway - Latest Free Exam Questions & Answers

Which JavaScript code segment should you use?

You are developing a customer web form that includes the following HTML.
<label id=”txtValue”X/label>
Information from the web form is submitted to a web service. The web service returns the
following JSON object.
{
“Confirmation”: “1234”,
“FirstName”: “John”
}
You need to display the Confirmation number from the JSON response in the txtValue label
field.
Which JavaScript code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
$(“#txtValue”).val = (JSONObject.Confirmation);

B.
$(“#txtValue”).val (JSONObject.Confirmation);

C.
$(“#txtValue”).text = (JSONObject.Confirmation);

D.
$(“#txtValue”).text (JSONObject.Confirmation);

Explanation:

http://api.jquery.com/text/

2 Comments on “Which JavaScript code segment should you use?

    1. Tongai Chiridza says:

      ooops my bad, used to working with forms: D seems more apropriate i concur: The .val() method is primarily used to get the values of form elements such as input, select and textarea




      0



      0

Leave a Reply