How do I show/hide an element in YUI as in jQuery?

Posted by Chad Johnson on Stack Overflow See other posts from Stack Overflow or by Chad Johnson
Published on 2010-12-27T20:51:22Z Indexed on 2010/12/27 20:54 UTC
Read the original article Hit count: 278

Filed under:
|

In jQuery, when I want to show or hide something, I do this:

$('#elementId').show();
$('#elementId').hide();

How do I do this with YUI? I've tried YAHOO.util.Dom.get('elementId').hide(), asked my co-workers, looked at the documentation, and searched Google, and I've found nothing helpful. From the documentation, it looks like this should work

YAHOO.util.Dom.get('elementId').setStyle('display', 'none')

but of course it does not. All I can think of is this, which sucks because then I'm not using a framework:

document.getElementById('elementId').style.display = 'none';

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about yui