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');
    }
}

1 Answer 1

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'))
1
  • I'm The Edge and that worked perfectly! Thank you! Commented May 20, 2016 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.