Very new at this so bear with me!
I'm attempting to create a checkbox function which disables the form input when toggled off. This is what my code looks like:
'use strict';
define('admin/settings/post', ['admin/settings'], function () {
var Module = {
};
Module.init = function () {
console.log('test');
$('[data-field="toggleUserRestrictions"]').on('click', function() {
if $('[data-field="toggleUserRestrictions"]').attr('checked') {
$('input[data-type="newUserRestrictions"]').attr('disabled', true);
} else {
$('input[data-type="newUserRestrictions"]').attr('disabled', false);
}
});
};
return Module;
});
Is there anything blatantly wrong with this code that I'm failing to see?