Set background based on SPAN contents
Posted
by danit
on Stack Overflow
See other posts from Stack Overflow
or by danit
Published on 2010-06-10T08:11:08Z
Indexed on
2010/06/10
8:22 UTC
Read the original article
Hit count: 131
jQuery
I need to set a different background image dependant on the contents of a SPAN:
<div class="replies">
<span>2</span>
</div>
If SPAN = 1 background-image: url('reply.png') no-repeat;
If SPAN = 'anything other than 1' background-image: url('replies.png') no-repeat;
Can this be done in jQuery?
© Stack Overflow or respective owner