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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -