Elgg
Version 2.3
|
Go to the source code of this file.
Functions | |
define (function(require){var $=require('jquery');var checkbox_selector= 'input[type="checkbox"][name="autogen_password"]';function togglePasswordInput($checkbox){var $form=$checkbox.closest('.elgg-form-useradd');if(!$form.length){return;}if($checkbox.is(':checked')){$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', false);$(this).closest('.elgg-field').addClass('hidden');});}else{$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', true);$(this).closest('.elgg-field').removeClass('hidden');});}}$(document).on('change', checkbox_selector, function(){togglePasswordInput($(this));});require(['elgg/ready'], function(){togglePasswordInput($(checkbox_selector));});}) | |
define | ( | function(require){var $=require('jquery');var checkbox_selector= 'input[type="checkbox"][name="autogen_password"]';function togglePasswordInput($checkbox){var $form=$checkbox.closest('.elgg-form-useradd');if(!$form.length){return;}if($checkbox.is(':checked')){$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', false);$(this).closest('.elgg-field').addClass('hidden');});}else{$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', true);$(this).closest('.elgg-field').removeClass('hidden');});}}$(document).on('change', checkbox_selector, function(){togglePasswordInput($(this));});require(['elgg/ready'], function(){togglePasswordInput($(checkbox_selector));});} | ) |
function(require){var | $=require('jquery');var checkbox_selector= 'input[type="checkbox"][name="autogen_password"]';function togglePasswordInput($checkbox){var $form=$checkbox.closest('.elgg-form-useradd');if(!$form.length){return;}if($checkbox.is(':checked')){$('[name="password"],[name="password2"]', $form).each(function(){.prop('required', false);.closest('.elgg-field').addClass('hidden');});}else{$('[name="password"],[name="password2"]', $form).each(function(){.prop('required', true);.closest('.elgg-field').removeClass('hidden');});}}.on('change', checkbox_selector, function(){togglePasswordInput();});require(['elgg/ready'], function(){togglePasswordInput();});} Toggle password input visibility based on the value of the autogenerate password checkbox |
{jQuery} | $checkbox Checkbox input |