Thursday, 14 January 2021

MVC - jQuery - Remove Class from control

 Watch this example on YouTube


 

1. View

     @Html.LabelFor(x => x.or.test,new { @id="someID", @class="red"});
   
}


@section Scripts{
    <script type="text/javascript">
 

        $(document).ready(function () {
            $("#someID").removeClass("red")
        });
    </script>
    }

2. CSS 


.red{
    color: red;
    font-size:40px;
}

No comments:

Post a Comment