SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    refereing to object dynamically after it is created dynamically

    Hi,

    Im sure this is a very silly problem, but im trying to create a li and then set its class in jquery but it doesn't seam to be working

    Code:
    		var listid = field + "_errormessage";
    
    		if (errorMessage != "")
    		{
    			$("#errorul").append("<li id='" + listid + "'>" + errorMessage + "</li>");
    		}
    		
    		$(listid).addclass("blue");

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    The variable listid is a string not a DOM element.


    $('#' + listid).addClass('blue');
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •