javascript - Using jquery to edit css attribute of a text without selector -


i trying apply smiley(emoji) users comments on page. example :) applied css attributes replaced with. there way can use javascript or jquery achieve this?

$(":)").css("background-image", "url('smile.gif')");  

my problem selector part, since dont want apply css whole div.

you need wrp html text ':)' html , can add css/jq it. see below javascript code , try add css "smiley" class

document.body.innerhtml = document.body.innerhtml.replace(':)', '');


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -