I am just trying to print a error message if someone leaves the text field blank using jquery.But it is not being displayed.
This is html code:

```
 <form id="form1" runat="server">
    <div>
    <table>
     <tr>
    <td>
   <label>Name</label></td>
   <td> <input class="required" type="text" name="name" id="name" /><span>(required)</span></td>
     </tr><tr>
    <td><br/><label>Address</label></td>
    <td><input class="required" type="text" name="address" id="address"/><span>(required)</span></td></tr>
     </table>
    </div>
    </form>

```

This is Jquery code.

```
$(document).ready(function () {
   var requiredFlag = ' * ';
    $('form :input').filter('.required').next('span').text(requiredFlag).end();
    if ($(this).is('.required')) {
       if (this.value == '') {
       var errorMessage = 'This is a required field';
                             };
            $('span></span').text(errorMessage).appendTo($(this));
                             }; 
});

```

May be i am missing something.
Help experts.
Thank you.