2

I am using JQuery for validating if the check-box is checked or not. If Column-A has some value in it, and the check-box should get checked while saving.(I can keep the code in presave function).

Or if i can get an alert when this checkbox is not checked.

if($("select[title='Platform']").val()!=null) {
    alert("hi");
    $( '#Feature_x0020_Dependency_6c8e1e07-570a-418a-83c57cee7e963aed_$BooleanField' ).prop( "checked", true );
}

It shows syntax error for the ID that I have added for checkbox.

  • What all have you written so far? – Taran Goel Nov 24 '15 at 8:55
  • What is your question? – Submits Nov 24 '15 at 8:55
  • The reason you get a syntax error is because you need to escape the special character $. – MickB Sep 7 '16 at 20:13
4

Try the following:

$('#Feature_x0020_Dependency_6c8e1e07-570a-418a-83c57cee7e963aed_$BooleanField').is(":checked")

UPDATE

Try $("[id$=_$BooleanField]").is(":checked") or $("[id$=_BooleanField]").is(":checked")

LEARNING

Please have a look at following for all jQuery selectors:
http://www.w3schools.com/jquery/jquery_ref_selectors.asp

We used id$ selector which means elements ending with id=value.. Following explains:
http://www.w3schools.com/jquery/sel_attribute_end_value.asp

  • it shows error 'Error: Syntax error, unrecognized expression: #Feature_x0020_Dependency_6c8e1e07-570a-418a-83c5-7cee7e963aed_$BooleanField(' – KumarV Nov 24 '15 at 9:02
  • check the update – Arsalan Adam Khatri Nov 24 '15 at 9:09
  • Please add some explanation (or link to reference) about those jQuery selectors, newbie users won't have a clue what is going on. – Danny '365CSI' Engelman Nov 24 '15 at 9:13
  • 2
    @DannyEngelman added. w3schools would do ? – Arsalan Adam Khatri Nov 24 '15 at 11:11
0

This should as expected:

($("#tdLanguage").children().find('input:checkbox').is(':checked'))

where #tdLanguage is ID of the field. For more information, read this article: Accessing Checkbox in SharePoint using JQuery

-1

It works fine with

$("[id$=_BooleanField]").is(":checked")

thanks

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.