On Sat, Aug 30, 2008 at 3:00 AM, Wonder95 <[EMAIL PROTECTED]> wrote:

>
> This will work
>
> $(function() {
>  $('#calculate-square-form input:text').blur(function() {
>    if (isNaN($(this).val())) {
>      var errorMessage = "Please enter only numbers";
>      $('#edit-square-area').after('<div>'+errorMessage+'</div>'); */
>      $(this).val('');
>    };
>  });
> });
> but it will display the error message for each time the user exits the
> field.  I want to add a class to the new div so I can filter on it and
> delete it if it exists at the beginning of the function, but
> adding .addClass adds the class to #edit-square-area, not my new div.
> How can I add the class to my new div?


$('#edit-square-area').after('<div class="error">'+errorMessage+'</div>');

- Richard

Reply via email to