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
Anu
1.1k
301
10.6k
Need to set the color of an element using a variable with javascript
Oct 12 2020 5:11 AM
Hi,
Please help me to use a variable inside e.cellElement.css("backgroundColor", "var(---" + result.value + ")"); using javascript. I am able to get the color value in the variable "result.value". But its not changing the color using the variable name. I am able to change the color, if I am writing the color name directly inside .css().
Below is the code which I am using.
function gettingcolour(e) {
if (e.column.dataField === "undefined") {
}
else
{
$.ajax({
type: "POST",
url: "/Home1/getcolurdetails", // the URL of the controller action method
data: { data: e.column.dataField },
/* data: "{'colname' :' " + e.column.dataField + "'}",*/ // optional data
success: function (result) {
e.cellElement.css("backgroundColor", "var(---" + result.value + ")");
},
error: function (req, status, error) {
alert('error')
}
});
}
}
Thanks
Hanusha
Reply
Answers (
4
)
Select item in dropdown List and appears in table
Record Get Very Late.