Click here to Skip to main content
15,896,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
whenever click check box at the time i had set required attribute to textbox but how can can remove required attribute whenever unclick check box thats why how to raise jquery unclick event after click event

C#
$('.schedule-check').click(function () {
           debugger;
            $('#Schedule_StartDate_' + ScheduleCount + '').attr('required', true) // to set required
        
            $('#Schedule_EndDate_' + ScheduleCount + '').attr('required', true) // to set required
          });


Please help me.
thank u

What I have tried:

whenever click check box at the time i had set required attribute to textbox but how can can remove required attribute whenever unclick check box thats why how to raise jquery unclick event after click event
Posted
Updated 12-Feb-19 7:26am

1 solution

Try:
JavaScript
$('.schedule-check').click(function () {
    $('#Schedule_StartDate_' + ScheduleCount).prop('required', this.checked);
    $('#Schedule_EndDate_' + ScheduleCount).prop('required', this.checked);
});
 
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