Tuesday, January 3, 2017

Jquery to check that checkbox is selected or not in visual force

If you wanna check whether a checkbox is selected or not in visual force please use the below jQuery snippet.

jQuery code snippet:


 function updateSelRecords(checkboxid or checboxstleclas)
    {
        var chbxClassId = '.'+checboxstleclas; // if your receiving checkbox styleclas
                     or 
        var chbxClassId = '#'+checkboxid; //if your receiving checboxId
  
        if($(chbxClassId).prop('checked'))
         {
      
           alert('Checkbox selected');
         }
         
        else
        {
         alert('Please select at least one record');
           return null;
        }
    }



Thanks for visiting...!

No comments: