[jQuery] attr('title') giving odd renaults
I'm using attr('title') to find the title of the first anchor in a
list and then make that title the value of an alt tag for an image.
$('#imageswap a:first').attr('href', function(){
var altName = $(this).attr('title');
$('#productimage').append('<img src='+ this +' alt='+ altName +'
class="product" />');
$('img.product').fadeIn(1000);
});
The problem is if the anchor title has spaces (title="firstWord
secondWord thirdWord") it gives me:
<img class="product" thirdword="" secondword="" alt="firstWord"
src="imageName.jpg"/>
Any ideas on why it's doing this? I can't figure it out.