Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question addClass(); not working

    In my code below, I am trying to add a class to an IMG for rk_image
    Please help

    Code:
    $("#front-page-holder ul").load(homelink+" #gallery1",function(data){
    				
    				$("#gallery1").find("a").attr("href",homelink).append("<h2>"+hometitle+"</h2><h3>"+homeauthorname+"</h3>").append($(data).find(".rk_image").html());
    				
    				
    			});

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,444
    Thanks
    11
    Thanked 598 Times in 578 Posts
    your selector is invalid:
    Code:
    homelink+" #gallery1"
    that puts something in front of an ID, implying that there is more than one of those IDs floating around, but you can only use an ID once...
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,864
    Thanks
    6
    Thanked 1,028 Times in 1,001 Posts
    No, that syntax is correct. In the load() function you can specify the URL of the page to load and a fragment identifier if you just want to load a specific fragment of the specified document rather than the whole document. “homelink” is a variable that probably has a URL stored.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,444
    Thanks
    11
    Thanked 598 Times in 578 Posts
    Quote Originally Posted by VIPStephan View Post
    No, that syntax is correct. In the load() function you can specify the URL of the page to load and a fragment identifier if you just want to load a specific fragment of the specified document rather than the whole document. “homelink” is a variable that probably has a URL stored.
    touche, forgot which side of the dot i was looking at!
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

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