I'd like to highlight an entire div when the user touches or selects the text contained in the div. I'm able to highlight the text only when it is contained in a span with a javascript function, but when I try to apply the function to the entire div it does not work. In my research I've seen many people remove a highlight with -webkit-tap-highlight-color:, is there a way to use this or another css style to add a highlight to an item that is not a link?
The script I am using:
function changeColor(e,color){ element = e; oldColor = element.currentStyle.background; element.style.background = color; }