I am planning to use the same XHTML5 file for data storage AND display. At design time, the file will be viewed in browser. At compile time, it will be parsed to generate UI content.
I want to store color data as an attribute of some list items. Then, when the page is loaded, the color data from each of these list items should be “transfered” to the background color of the item, so that I can check the colors visually in the browser, and have the hex-string easily parseable from the XHTML.
What I already have (just one line of each part):
(...)
<body>
<ul>
<li data-color="#ffeeaacc">EMG</li>
</ul>
<script>
$('a[data-color]').??????
</script>
</body>
I am very very n00b in javascript and Jquery, and cannot figure out what should I do from now. The end result should be equivalent to:
<li data-color="#ffeeaac" style="background: #ffeeaacc">EMG</li>
Thanks!
#ffeeaaccis not a valid HEX color. HEX colors contain only three pairs of two-digit numbers, not four.http://jsfiddle.net/CQqRX/1/