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 2 of 2
  1. #1
    Regular Coder syco__'s Avatar
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    194
    Thanks
    41
    Thanked 4 Times in 4 Posts

    jQuery attribute problem!

    I currently have this bit of code
    Code:
    $('#thumbs').delegate('img','click', function(){
    	$('#mainImage').attr('src',$(this).attr('src').replace('thumb','large'));
    	$('#description').html($(this).attr('alt'));
    });
    This code works fine but i am try to expand it so that when the picture changes i can get the link to change as well i have tried the following code but i am very inexperienced with jQuery and i am struggling to get it working that way.

    Code:
    if ($('#mainImage').attr('src') = "images/image_01_large.jpg") {
    	$('#link').attr('href') = "http://www.facebook.com"
    }
    Any help or suggested to get it working would be great.
    Thanks
    Last edited by syco__; 12-19-2011 at 10:06 AM.
    .pLeAd InSaNiTy.

  • #2
    Regular Coder syco__'s Avatar
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    194
    Thanks
    41
    Thanked 4 Times in 4 Posts
    never mind after playing with the code a little a managed to make this happen.

    Thanks anyway.
    .pLeAd InSaNiTy.


  •  

    Posting Permissions

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