jQuery toArray() methodThe toArray() method is used to return all elements contained in the jQuery set as an array. SyntaxThis method does not accept any argument. We can understand the use of the toArray() method using an example. ExampleIn this example, we are using the toArray() method to convert the paragraphs into an array. On clicking the given button, the paragraph elements will be converted to an array, and an alert box will display that shows the innerHTML of the paragraph elements. Test it NowOutput After clicking the given button, an alert box will be displayed, as shown in the below screenshot. Similarly, three more alert boxes will be displayed by clicking the OK button in the alert box. This is because there are four paragraph elements in the program. Next TopicjQuery removeProp() method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India