Question: Java Script c10 Question 9 (1 point) Which of the following coding sequences can be used to validate the data on a form and submit
Java Script c10
Question 9 (1 point)

Which of the following coding sequences can be used to validate the data on a form and submit it to the server?
Question 9 options:
| Within the click event handler of a regular button, validate the data and then issue the submit method of the form if the data is valid. | |
| Within the click event handler of a regular button, validate the data and then issue the submit method of the form if the data is valid or the preventDefault method if it isnt. | |
| Within the click event handler of a submit button, validate the data and then issue the submit method of the form if the data is valid | |
| Within the click event handler of a submit button, validate the data and then issue the submit method of the form if the data is valid or the preventDefault method if it isnt. |
Save
Question 10 (1 point)

Code example 10-1 $(document).ready(function() { $("#contact_me").change( function() { if ($("#contact_me").attr("checked")) { $(":radio").attr("disabled", false); } else { $(":radio").attr("disabled", true); } } ); });
(Refer to code example 10-1) What does this code do?
Question 10 options:
| It disables or enables a specific radio button when an element is checked or unchecked. | |
| It disables or enables all radio buttons when an element is checked or unchecked. | |
| It disables or enables a specific check box when an element is checked or unchecked. | |
| It disables or enables all check boxes when an element is checked or unchecked. |
Save
Question 11 (1 point)

Code example 10-1 $(document).ready(function() { $("#contact_me").change( function() { if ($("#contact_me").attr("checked")) { $(":radio").attr("disabled", false); } else { $(":radio").attr("disabled", true); } } ); });
(Refer to code example 10-1) What do the jQuery selectors in this code select?
Question 11 options:
| individual elements by id only | |
| disabled radio buttons only | |
| an individual element by id and disabled radio buttons | |
| an individual element by id and all radio buttons |
Save
Question 12 (1 point)

Code example 10-2 $(document).ready(function() { $("#member_form").submit( function(event) { var isValid = true; . . var password = $("#password").val().trim(); if (password == "") { $("#password").next().text("This field is required."); isValid = false; } else if ( password.length
(Refer to code example 10-2) What does the preventDefault() method in this code do?
Question 12 options:
| It cancels the change() event method of the form. | |
| It cancels the submit() event method of the form. | |
| It triggers the change() event method of the form. | |
| It triggers the submit() event method of the form. |
Save
Question 13 (1 point)

Code example 10-2 $(document).ready(function() { $("#member_form").submit( function(event) { var isValid = true; . . var password = $("#password").val().trim(); if (password == "") { $("#password").next().text("This field is required."); isValid = false; } else if ( password.length
(Refer to code example 10-2) Why is the following line of code necessary after the if-else statement? $("#password").val(password);
Question 13 options:
| The val() method removes the password entered by the user, so this code displays the original password. | |
| The next() method replaces the password entered by the user, so this code displays the original password. | |
| The text() method replaces the password entered by the user, so this code displays the original password. | |
| The trim() method removes extra spaces entered by the user, so this code displays the trimmed password. |
Save
Question 14 (1 point)

Which of the following methods is not one of the methods that trigger events?
Question 14 options:
| focus() | |
| change() | |
| leave() | |
| select() |
Save
Question 15 (1 point)

In the following code, what does the line of code in the else clause do? $(document).ready(function() { $("#join_list").click(function() { // join_list is a regular button if ( $("email_address").val() == "") { alert("Please enter an email address."); } else { $("#email_form").submit(); } }); });
Question 15 options:
| It handles the submit() event method. | |
| It triggers the submit() event method. | |
| It handles the click() event method. | |
| It triggers the click() event method. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
