How to change color dynamically for specific text in jquery val() function.
- I want to change color for specific text and below is my code;
$("#" + id).val("141"+ " " + "(Only 140 characters will be shown on Twitter)").css('color', 'red');
- I have implemented this code but red color has set for all text.
- I would like to set color red for "141" only.
- Also, I have tryed with different solution like, 1) using tag for "141" text. 2) using append, But I'm not getting proper result.
- Please suggest me proper answer for this code.


Manas MohapatraRank #182 · 13.2K reputationPosted Jul 25, 2017, 8:50 PM EDT
Naveen BishtRank #1,462 · 1.1K reputationPosted Sep 19, 2017, 2:35 AM EDT