Want to build the ChatGPT based Apps? Start here
Become a member
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
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Hanusha Loujith
1.9k
292
6.2k
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.