0

Im using SharePoint 2010 and have created a CEWP that displays fields associated with a checkbox when it is clicked and has a check. I need to check the value of the checkbox on the load as well and I'm not catching it for some reason. What am I doing wrong?

$(document).ready(function()
{
    alert('onload');
    //Hides /Shows Fields on load?
    if (("input[title$='Phone Data Collection']").is(':checked'))
    //if (("input[title$='Phone Data Collection']").checked
    {
        alert('inside show for phone');
    }
}
2

The condition of "if" is missing the character $ or the word jQuery, that identifies you are using a jquery selector for the element.

Try to replace it for:

if ($("input[title$='Phone Data Collection']").is(':checked'))
| improve this answer | |
  • I'm The Edge and that worked perfectly! Thank you! – John May 20 '16 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.