Thursday 14 January 2021

MVC - jQuery - Add Class to the control

 Watch this example on YouTube


 

 

1. View

 

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


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

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

 

2. CSS

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

No comments:

Post a Comment