Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I want to check a chxkbox inside dropdownlist change event

my code is like below

HTML
$('#ddlrole').change(funtion()
{
$('#namecheckbox').attr('checked','checked');
});



my checkbox and dropdownlist is like below

SQL
@Html.DropDownList("Roles", new SelectList((IEnumerable<EmployeeManagementSystem.DAO.RoleMaster>)ViewData["Roles"], "RoleId", "RoleName"), "Select Role", new { @id = "ddlrole", @class = "med m-wrap" })
                                       @Html.CheckBox("CheckBox", new { id = "namecheckbox"})


but its not working

anybody help me


thanks
kunjammu
Posted
Updated 8-Jun-14 22:55pm
v3

try below
JavaScript
$(document).ready(function () {
    $("#<%=ddlrole.ClientID%>").change(function () {
          $("#<%=namecheckbox.ClientID%>").prop('checked',true);
});
 
Share this answer
 
you can try like this
$('#ddlrole').change(funtion()
{
    $('#namecheckbox').get(0).checked = true;
});
 
Share this answer
 
Comments
Kunjammu 9-Jun-14 5:03am    
not working...

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