I need to write a javascript/jquery code that make the checkbox if unchecked do not put a validation of a textbox and if checked the text box is validated for null or empty in my SP 2010 list form.
I have written code for checking the checkbox, and it works but when I uncheck the checkbox which is already checked, I am not able to get the value or trigger the event.
I added this code within a content editor web part.
$(document).ready(function() {
$("#ctl00_m_g_97fe2364_4242_487c_9dbc_8d1547697f5e_
ctl00_ctl05_ctl17_ctl00_ctl00_ctl04_ctl00_ctl00").
change(function()
{
var checked0 = $(this).is(":checked");
if (checked0)
{
// alert('orc bi epm is checkedd111');
$("input[title='ORCBIEPM']").focus();
$("input[Title='ORCBIEPM']").css("background-color","#FE2E2E");
ORCBIEPMchecked =true;
}
else
{
ORCBIEPMchecked =false;
}
});