YUI 3: How to get your own DOM element enclosed inside Node?

I used this simple technique to get my own DOM element in jQuery:

var el = $('#myid'); var native = el[0]; //or el.get(0); 

How can I do this in YUI 3? For example, I want to use the getElementsByName DOM method, which is not supported by YUI 3.

+6
source share
1 answer
 var el = Y.one("#myid"); var native = el.getDOMNode(); 

If you cannot be sure that '#myid' is in the DOM, then you must first check for null. YUI.one does not work like in jQuery.

 var el = Y.one("#myid"), native; if (el !== null) { native = el.getDOMNode(); } 
+6
source

All Articles