jquery set css for class code example

Example 1: javascript remoev css class

//remove a css class from an element
document.getElementById("myElementID").classList.remove("class_name");

Example 2: Javascript change element class

document.getElementById("myElementID").classList.add('myClassName');
document.getElementById("myElementID").classList.remove('myClassName');

Example 3: To set HTML attribute and css styles in html helper control in mvc

@Html.ActionLink(emp.Name, "EmployeeDetail", new { Id = emp.Id },
                 new { target="_blank", 
                  	  style="font-weight: bold;color: red;"})

Tags:

Css Example