jquery code to set color for a paticular string -


i have string this:

var report = 'verifying wireless interface present , state disconnected:passed<br>verify profile not present on client:passed<br>add profile client:passed<br>verify profile added present on client:passed<br>connecting access point:passed<br>verify state connected:passed<br>disconnecting access point:passed<br>verify state disconnected:passed<br>reconnecting access point:passed<br>verify state connected:passed<br>verify ping gateway (access point):passed<br>verify signal strength greater 75%:passed<br>verify round trip time not greater 30 millieseconds:passed<br>disconnecting access point:passed<br>verify state disconnected:passed<br>delete profile client:passed<br>verify profile not present on client:failed<br>'; 

from this, have set green color passed string , red color failed string. how possible...

you need wrap words in element

report = report.replace(/:passed/g, ':<span class="passed">passed</span>').replace(/:failed/g, ':<span class="failed">failed</span>'); 

then

.passed {     color:green } .failed {     color:red; } 

demo: fiddle


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -