Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3876580
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:23:53+00:00 2026-05-19T22:23:53+00:00

In my HTML I have something like this <input type=button value=Delete onclick=delete(this);/> and in

  • 0

In my HTML I have something like this

<input type="button" value="Delete" onclick="delete(this);"/>

and in the JavaScript file I define my function “delete” like this:

YUI().use('node', functioin(Y) {
   function delete(el){
       //Here is the problem
       el.get('parentNode');
   }
}

The problem is, I want to convert the “el” object (which is a normal JavaScript object) to a node of YUI 3 so that I can use YUI 3’s functions more conveniently. And I don’t know how to do it.

What is the solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:23:54+00:00Added an answer on May 19, 2026 at 10:23 pm

    YUI 3’s Y.Node constructor can simply take in a DOM element or selector string and return a new Y.Node instance:

    // returns a Y.Node instance wrapping a div DOM element
    var node = new Y.Node(document.createElement('div'));
    

    But, the preferred way is the use the convenient Y.one factory method:

    // returns a Y.Node instance wrapping a div DOM element
    var node = Y.one(document.createElement('div'));
    

    Also, YUI 3 has a Y.NodeList class which represents a collection of Y.Node instances:

    // returns a Y.NodeList representing all divs on the page
    var divs = new Y.NodeList(document.getElementsByTagName('div'));
    
    // or using the convenient Y.all NodeList factory method:
    divs = Y.all(document.getElementsByTagName('div'));
    
    // …and finally the preferred way to do this using a selector string:
    divs = Y.all('div');
    

    In generally, use Y.one and Y.all to rerun a Y.Node and Y.NodeList instance respectively; this is how you will see YUI 3 code written, and what all the examples will use.

    For your specific use case of wanting to remove a DOM element which you already hold a reference to you could do the following using YUI 3’s Y.Node class:

    // assumes el is a DOM element reference
    Y.one(el).remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is beyond both making sense and my control. That being said here is
I have a script that appends some rows to a table. One of the
We manage a site for a medical charity. They have a number of links
I am trying to load a html page through UIWebview.I need to disable all
IE is giving me an undefined NAN when i try to view the calender...
I'm trying to build a C++ extension for python using swig. I've followed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.