TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dr.Ajay Kashyap
NA
521
284.1k
How to Change Text Color Using Java Script In MVC
Dec 7 2016 2:24 AM
Hello....Plz Help
i want to change the color of div="cnt" which Show
Remaining Character. if Character More The 28 Then want Color In Green Other Wise by default Red
HTML CODE:-
<div class="col-md-4">
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control"} })
@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
<div id="cnt" style="color:red;"></div>
</div>
JAVASCRIPT:-
$("#Title").keyup(function () {
var lenCount = document.getElementById('Title');
var count = 145 - lenCount.value.length;
document.getElementById('cnt').innerHTML = count + ' ' + 'Character Remaining';
I DO This But It Not Work:-
if (count >= 28) {
document.getElementById("cnt").style.color = "#ff0000";
}
if (count == 145) {
$("#cnt").html('');
}
});
Reply
Answers (
1
)
Merge two videos and send in api response
how to send my order id from pay pal ??