html - Apply CSS class to JavaScript variable? -


does know how can apply css class javascript variable?

i have 2 variables:

var usr = 'you: ' + userinput; var rpl = 'chatbot: ' + chatbot.transform(userinput); 

the usr variable human input system, , rpl variable triggers response database.

i need each variable have different css class applied it.

can help?

it depends how these variables injected page, may want wrap them in span tag see end up.

var usr = "<span class='user-input'>you: " + userinput + "</span>"; var rpl = "<span class='chatbot'>chatbot: " + chatbot.transform(userinput) + "</span>"; 

use .user-input ans .chatbot in css.

another thing try hunt down html tag data injected in page through source code. possible through javascript (jquery) add class targeted html tag.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -