javascript - Changing the background color of a :before element based on a php variable -
i'm trying change background color of :before element php variable. variable neatly returns hex code #123456. tried piece of jquery/javascript working, isn't. know i'm doing wrong?
<script> $(document).ready(function(){ $('#tpl-contact:before').css("background", "<?=$scolor;?>"); }); </script>
try not using jquery that. html , css should suffice.
another way find out how works step step, e.g. does:
$('#tpl-contact:before').css("background", "#123456");
already want do? if yes, continue, if not, have excluded php culprit. way.
the question"how access style properties of pseudo-elements jquery?" might have additional pointers well.
Comments
Post a Comment