0

I would like to know how to add css background-image:url("xxxxx") property to my code.

jQuery('#'+$trackID+' .sc_thumb').attr('src',$thumb_url);
jQuery('#'+$trackID+' .sc_container').css('display','block');

What i would like to do is to add to the second row property background-image:url("") and put the $thumb_url value inside so I can have a background from that image.

I guess this should be added to .css property somehow, and I have tried different ways but I can't get this to work. Any ideas?

1 Answer 1

2

you can try

jQuery('#'+$trackID+' .sc_container')
.css({
    'display':'block',
    'background-image' : 'url('+ $thumb_url +')'
    });

or

jQuery('#'+$trackID+' .sc_container')
.css('display','block')
.css('background-image' , 'url('+ $thumb_url +')');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.