Search code examples
jqueryprototypejs

click function in prototypejs


How can I write the following jquery in prototypejs?

<a class="button view" style="cursor:pointer" id="addComment"></a>

$(function() {
 $("#addComment").click(function(){

         alert("hello world");
     });
});

Solution

  • Working demo

    Event.observe('addComment', 'click', function(event) {
        alert('u clicked on click here');
    });​