I've used this simple technique to get a native 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 getElementsByName
DOM method, which is not supported by YUI 3.
var el = Y.one("#myid");
var native = el.getDOMNode();
If you can't be confident that '#myid' is in the DOM then you should check for null first. YUI's .one doesn't chain like in jQuery.
var el = Y.one("#myid"), native;
if (el !== null) {
native = el.getDOMNode();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With