Monday, 4 January 2016

Converting a jQuery Object to Native DOM Element

Source : Converting a jQuery Object to Native DOM Element
Published On : January 04, 2016 at 02:28PM
By : Agbonghama Collins

jQuery is a great JavaScript library that abstracts away the pain in HTML document transversal and manipulation, event handling, animation, and Ajax with an easy-to-use API that works across multiple browsers.

A need to convert a jQuery object to native DOM element may arise in your future project and the conversion is easy as calling get() method on the object likes so:

$("#hello").get(0)

The code above is equivalent to plain JavaScript document.getElementById( "hello" )

Without a parameter, .get() returns an array of all matched elements.…



For More Go to : W3Guy – A Geek's Diary

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home