Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
how to focus this check box in mvc
SQL
@Html.CheckBox("chkrmark", false, new { id = Model.objremarksmasterlist[loop].remarksid })


any suggestion??
Posted
Updated 1-May-14 21:15pm
v2
Comments
Sanket Saxena 2-May-14 2:57am    
When you want to put focus and what kind of focus i mean what css you want to apply?
Amalraj Ramesh 2-May-14 3:07am    
NO, i have this check box in popup, I want set focus when popup show..
Amalraj Ramesh 2-May-14 3:08am    
is there any way to do like this

@Html.CheckBox("chkrmark", false, new { id = Model.objremarksmasterlist[loop].remarksid, focus=true })
Sampath Lokuge 2-May-14 3:14am    
Is it ok to do this by using jQuery ?
Amalraj Ramesh 2-May-14 3:18am    
there is no proparty for Focus()????

JavaScript
<script type="text/javascript">
    $(function () {
        $("#chkrmark").first().focus();
    });
</script>


or

JavaScript
<script type="text/javascript">
    $(function () {
        $("#chkrmark")[0].focus();
    });
</script>
 
Share this answer
 
v2
You would use javascript or JQuery rather than MVC code.
For e.g.
(function() {
  $("#chkrmark").first().focus()
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900