I have a colour picker widget on my page. I'm trying to attach an event handler that will take the selected colour and apply a list of CSS rules to an iFrame on my page. The iFrame is on the same domain as my page, so updated the css inline isn't an issue.
The issue is that I need to use pseudo class selectors (like :hover etc) in some of my styles, which cant be done inline. I could make a style element and append it to the head of my iFrame, but that would mean a new element gets added each time a new colour is picked. Is there any way to 'replace' the style element each time a colour is picked? Or alternatively, is there an easier solution to my problem?