Can someone tell how to have a button chnage colour on selection. and change back once another link is selected. I have tried using
::selection selector in css (but this is not compatible in ie)
Thanks
Jonathan
Can someone tell how to have a button chnage colour on selection. and change back once another link is selected. I have tried using
::selection selector in css (but this is not compatible in ie)
Thanks
Jonathan
Have you explored using JavaScript as an option?
document.getElementById("id").style.backgroundColor="value"
Here is a more complete example that you can play around with:
<html>
<head>
<script type="text/javascript">
function chgBtn()
{
document.getElementById("btn").style.backgroundColor="red";
}
</script>
</head>
<body>
<button id="btn" type="button" onclick="chgBtn()">Set background color</button>
</body>
</html>
Thanks for your swift reply. This works great but once I click on the button this stays red even if i click on a different link.
I would like the button to change colour on selection but if i was to select a different link or any other part of the page. I would like the button to change to its original colour.
Sorry, missed the part about the color changing back when you click on another link. Hmmm. I need to get back to you on this one.
got this sorted using some java of stack overflow.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.