css - How to set @Html.Checkbox() is checked when clicking the text beside? -


i have line contains checkbox , text. this: @html.checkbox("cb1") @: checkbox, , requirement is: when hover "my checkbox", checkbox cb1 hovered. when click "my checkbox", cb1 clicked.

i have tried this, doesn't work:

<tr>      <td>@html.checkbox("cb1")</td>      <td><label id="text">my checkbox</label></td> </tr> 

with css:

#text:hover #cb1:hover { /* mean: if #text hovered, #cb1 hovered too. doesn't work */ } 

can me?

you don't need css.
set for attribute in <label> id of control identifies.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -