jQuery(document).ready(function($) { // $('#show-tokens').on('click', function() { // if ($('input.token').attr('type') == 'password') { // $('input.token').attr('type', 'text'); // $(this).addClass('dashicons-hidden').removeClass('dashicons-visibility') // } else { // $('input.token').attr('type', 'password'); // $(this).addClass('dashicons-visibility').removeClass('dashicons-hidden') // } // return false; // }); $('input.token').each(function() { var token = $(this) var toggle = $(''); token.wrap('').after(toggle); toggle.on('click', function() { if (token.attr('type') == 'password') { token.attr('type', 'text') toggle.addClass('dashicons-hidden').removeClass('dashicons-visibility') } else { token.attr('type', 'password') toggle.addClass('dashicons-visibility').removeClass('dashicons-hidden') } return false; }); }); $('.repo-toggle').on('click', function() { var id = $(this).data('repo'); $('.repo-'+id).toggleClass('open') $('.repo-'+id+' > ul.packages').slideToggle(400) return false; }); });