Search code examples
javascriptyui

YUI equivalent to removeAttribute() JavaScript method


What is YUI equivalent to below JavaScript code?

document.getElementById("myDiv").removeAttribute("id");

Solution

  • I'm guessing you're meaning YUI2. But in case you meant YUI3, it's exactly like the DOM method:

    Y.one('#myDiv').removeAttribute('someAttribute');
    

    You can read a list of all Y.Node methods in the API docs: http://yuilibrary.com/yui/docs/api/classes/Node.html