Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prototype: Covert this visibility checking script to prototype syntax?

How do I convert this small script to Prototype:

Basically I need to check if an element is visible or not, I do with jquery this way: $('id_element').is(':visible'); but I dont know how to do it similar with Prototype.

<div id="myDiv" style="display:none">A Div</div>
<script>
if(document.getElementById('myDiv').style.display == 'none') alert('visible');
else alert('hidden');
</script>

Thank you!

like image 393
BoDiE2003 Avatar asked Feb 02 '26 14:02

BoDiE2003


1 Answers

Should be:

$('myElementID').visible();

Note that you do not use '#' to reference the element by id like you do in jQuery.

like image 174
Mike Webb Avatar answered Feb 05 '26 08:02

Mike Webb