On Aug 30, 2008, at 4:12 PM, Wonder95 wrote:
$('#edit-square-area').after('<div class="error">'+errorMessage+'</
div>');
- Richard
OK, thanks, that works in this case. But say for some reason I need
to add a class to the <div> dynamically. What would the syntax be to
shift focus to that element after appending it to #edit-square-area so
that I could use addClass?
$('<div class="error">'+errorMessage+'</div>').insertAfter(('#edit-
square-area').addClass('foo');
or if you want to add the class later:
var $error = $('<div class="error">'+errorMessage+'</
div>').insertAfter(('#edit-square-area');
// do whatever
$error.addClass('foo');
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com