1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.

Select a radio / checkbox in JS

Aug 5, 2013
Select a radio / checkbox in JS
  • Code (Javascript):
    // get the div that contains the checkboxes
    // this div is the element which uses the elemnent's full name as its id.
    var div = $('tablename___elementname');
     
    //get its checkboxes
    var inputs = div.getElements('input[type=checkbox]');
     
    //or to get radiobuttons
    var inputs = div.getElements('input[type=radio]');
     
    //access a specific input and see if its checked or not
     
    if(inputs[0].checked){
        alert('the first input is checked')
    } else {
        alert('the first input in not checked');
    }