Question from the jQuery test

How to bind a click event to a div, p and b elements in jQuery.

Medium

Here is the following code. When clicked, which statements are true?

<script type="text/javascript"src="jquery.js"></script>
<div>
   <p><b>Bold paragraph in a div</b></p>
</div>
<script type="text/javascript">
    $('div').bind('click', function(event){
        alert($(this).attr('nodeName'));
    });
    $('p').bind('click', function(event){
        alert($(this).attr('nodeName'));
    });
    $('b').bind('click', function(event){
        alert($(this).attr('nodeName'));
    });
</script>

Author: InconnuStatus: PublishedQuestion passed 257 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!