Reputation: 43
I have css like this:
.cls .imageX
{
float:left;
}
.cls .imageY
{
float:right;
}
it is being used in a page like this:
<div class="cls">
<a href="" class="imageX"><img src="left.png"/></a>
<a href="" class="imageY"><img src="right.png"/></a>
</div>
I don't have the site's source code. I see this source via firebug and I have to write JS code to change it via onload event. That is my job. Now I would like it to become:
<div class="cls">
<a href="" class="imageX"><img src="right.png"/></a>
<a href="" class="imageY"><img src="left.png"/></a>
</div>
There are two ways I think I may be able to resolve this but sadly none work for me at all
1> $('.cls .imageX img').attr('src','right.png');
$('.cls .imageY img').attr('src','left.png');
2> $('.cls .imageX').css('float','right');
$('.cls .imageY').css('float','left');
Upvotes: 0
Views: 139
Reputation: 701
Option 1 that you provide...seems to work. alert($('.cls .imageX img').attr('src', 'right.png').attr('src'));
Checkout my jsfiddle: http://jsfiddle.net/MYDNv/
Upvotes: 1