Javascript Week 13 PDF
Document Details
Uploaded by BetterThanExpectedLearning9144
Yeungjin University
Tags
Summary
This document contains a set of questions and answers on DOM Manipulation in Javascript and jQuery.
Full Transcript
JAVASCRIPT WEEK 13 1. Which of the following statements pertains to DOM Manipulation? a. jQuery contains powerful methods for changing and manipulating HTML elements and attributes. b. One very important part of jQuery is the possibility to manipulate the DOM. c. DOM related methods...
JAVASCRIPT WEEK 13 1. Which of the following statements pertains to DOM Manipulation? a. jQuery contains powerful methods for changing and manipulating HTML elements and attributes. b. One very important part of jQuery is the possibility to manipulate the DOM. c. DOM related methods make it easy to access and manipulate elements and attributes. d. All of the above \# 2. The following items are jQuery methods for DOM manipulation except: a. text() b. html() c. val() d. get() \# 3. Under DOM manipulation, it set or returns the value of form fields. a. text() b. html() c. val() \# d. get() 4. Under DOM manipulation, it sets or returns the content of selected elements. a. text() b. html()\# c. val() d. get() 5. Under DOM manipulation, it sets or returns the text content of selected elements. a. text() \# b. html() c. val() d. get() 6. Under DOM manipulation, when this method is used to return content, it return the text content of all matched elements (HTML markup will be removed). a. text() \# b. html() c. val() d. get() 7. Under DOM manipulation, when this method is used to set content, it overwrites the content of matched element. a. text() \# b. html() c. val() d. get() 8. After using a method to return content HTML markup will be removed. To return the innerHTML of the selected elements what method can be used? a. text() b. html() \# c. val() d. get() 9. What is the correct syntax if you want to return text content? a. \$(selector).text() \# b. \$(selector).text(content) c. \$(selector).text(function(index,currentcontent)) d. \$ (selector).html(function(index,currentcontent)) 10. What is the correct syntax if you want to set text content? a. \$(selector).text() b. \$(selector).text(content) \# c. \$(selector).text(function(index,currentcontent)) d. \$(selector).html(function(index,currentcontent)) 11. What is the correct syntax if you want to set text content using a function? a. \$(selector).text() b. \$(selector).text(content) c. \$(selector).text(function(index,currentcontent)) \# d. \$(selector).html(function(index,currentcontent)) 12. For DOM manipulation, which statement is true for html() method? a. When this method is used to return content, it returns the content of the FIRST matched element. b. When this method is used to set content, it overwrites the content of ALL matched elements. c. A and B are true \# d. Neither A nor B is true 13. What is the syntax for html() method when you want to return content? a. \$(selector).html() \# b. \$(selector).html(content) c. \$(selector).html(function(index,currentcontent)) d. \$(selector).text(function(index,currentcontent)) 14. What is the syntax for html() method when you want to set content? a. \$(selector).html() b. \$(selector).html(content) \# c. \$(selector).html(function(index,currentcontent)) d. \$(selector).text(function(index,currentcontent)) 15. For DOM manipulation, which statement is true about val() when used to return value? a. This method return the value of the value attributes of the FIRST matched element. b. The syntax is \$(selector).val() c. A and B are true \# d. A only is true 16. In DOM manipulation, which statement is true for val() method? a. The val() method is mostly used with HTML form elements. \# b. \$(selector).val() - sets the value of the value attribute for ALL matched elements. c. \$(selector).val(content) -returns the value of the value attribute of the FIRST matched element. d. \$(selector).val(function(index,currentvalue)) - set and return attribute using a function. 17. In jQuery, this method is used to get, set or change attribute values. a. text() method b. html() method c. val() method d. attr() method \# 18. Which of the following statements might be true for jQuery attr() method when you return the value of an attribute? a. When this method is used to return attribute value, it returns the value of the FIRST matched element. b. The syntax to return the value of an attribute value is \$(selector).att(attribute) c. Either A or B \# d. Neither A nor B 19. When attr() method is used to set attribute values, it sets one or more attribute/value pairs for the set of matched elements. Which is the correct syntax to set the attribute and value? a. \$(selector).attr(attribute) b. \$(selector).attr(attribute,value) \# c. \$(selector).attr(attribute,function(index,currentvalue)) d. \$(selector).attr({attribute:value, attribute:value,...}) 20. What is the correct syntax for setting multiple attributes and values? a. \$(selector).attr(attributes) b. \$(selector).attr(attributes,value) c. \$(selector).attr(attribute, function(index,currentvalue)) d. \$(selector).attr({attribute:value, attribute:value,...}) \# 21. What are the jQuery methods used to add new content? a. append(), prepend(), after(),before() \# b. text(), html(),val(), attr() c. submit(),change(),focus(),blur() d. load(),resize(),scroll(),unload 22. In jQuery method, what method can be used to add new content by inserting it at the end or at the beginning of the selected elements? a. append() and prepend() \# b. after() and before() c. either a or b d. neither a nor b 23. Which of the following statements is true about adding new contents in jQuery? a. Both append() and prepend() methods can take an infinite number of new elements as parameters likewise after() and before(). \# b. Only append() and prepend() methods can take infinite number of new elements as parameters. c. Only after() and before() methods can take infinite number of new elements as parameters. d. Both methods are limited to take new elements as parameters. 24. In jQuery methods to remove existing elements, which is used to remove the selected elements and its child elements? a. remove() \# b. empty() c. delete() d. erase() 25. In jQuery methods to remove existing elements, which is used to remove the child elements of the selected elements? a. remove() b. empty() \# c. delete() d. erase() 26. What are the methods used in jQuery in manipulating CSS? a. remove(), empty(), delete(), erase() b. append(),prepend(),after(),before() c. addClass(), removeClass(), toggleClass, css() \# d. text(),html(),val() 27. In jQuery Manipulating CSS, what method are you going to use to toggles between adding/ removing classes from the selected elements? a. addClass() b. removeClass() c. toggleClass() \# d. css() 28. In jQuery Manipulating CSS, what method is used to set or returns one or more style properties for the selected elements? a. addClass() b. removeClass() c. toggleClass() d. css() \#