This project has moved and is read-only. For the latest updates, please go here.

Displaying field based on Yes/No checkbox

May 5, 2015 at 8:46 PM
I'm trying to figure out how to add a click listener to the yes/no checkbox. Any help would be apprciated. So far I use SPUtility.GetSPField('<fieldname>') to get the field but now how to I add a click listener. On another post I saw code that used .observe but I could not get that working for yes/no. I could not get onClick to work either.
May 6, 2015 at 3:04 AM
You can use the Checkbox property on the returned object and then use jQuery to add a click listener:
var field = SPUtility.GetSPField('Is important?');
$(field.Checkbox).click(function(){
   alert('clicked!');
});
May 6, 2015 at 3:22 AM
Ah ok, thanks, that makes sense. I just had my syntax wrong when I tried using .click