If you are looking to extract the rel
attribute from an anchor element and wrap it in 'url("...")'
, transforming it into a new string, follow these steps:
<a href="http://something.com" rel="http://whatever.com">Test</a>
The desired result would be:
'url("http://whatever.com")'
To achieve this, utilize the following code snippet:
var newString = 'url("' + $(this).attr("rel") + '")';
(Assuming that this
refers to the specific anchor element.)
To integrate this with the existing code in your query, consider the following approach:
$(function() {
$('#list li a').hover( function(){
$("#meow").css( "background", 'url("' + $(this).attr('rel') + '")' );
});
});