I am setting background color of an li element by the code below :
$('#li123').animate({ backgroundColor: color}, 'slow');
It works fine but the color spans whole length of li. What do I do if I want it to span the text contained in the li only.
Wrap the text inside the
liin aspanand do theanimateon the span instead. If you need top and bottom margin of the animated area you could usedisplay: inline-blockon thespan.