Exercise (01) - Solution

Supply an event handler to the <a> element, to display 'hello world' in the <span> element with the id "output"!

by bombo

HTML

<div id="container">
    <p><a href="#">Say hello!</a></p>
    <p><span id="notMe1">&nbsp;</span></p>
    <p><span id="notMe2">&nbsp;</span></p>
    <p><span id="output"></span></p>
    <p><span id="notMe3">&nbsp;</span></p>
    <p><span id="notMe4">&nbsp;</span></p>
</div>

JavaScript

$(document).ready(function () {
    $('a').click(function (event) {
        $('#output').html('Hello World!');
    })
});