如何用jQuery实现复杂长尾词的全选功能?
- 内容介绍
- 相关推荐
本文共计171个文字,预计阅读时间需要1分钟。
javascriptjQuery.fn.extend({ // 简单的Jquery全选功能 selectAll: function() { return this.each(function() { $(this).find('input[type=checkbox]').prop('checked', true); }); },
// 简单的Jquery全不选功能 deselectAll: function() { return this.each(function() { $(this).find('input[type=checkbox]').prop('checked', false); }); },
// 简单的Jquery切换选中状态 toggleSelection: function() { return this.each(function() { $(this).find('input[type=checkbox]').each(function() { $(this).prop('checked', !$(this).prop('checked')); }); }); },
// 简单的Jquery显示元素 showElement: function() { return this.each(function() { $(this).css('display', 'block'); }); },
// 简单的Jquery隐藏元素 hideElement: function() { return this.each(function() { $(this).css('display', 'none'); }); },
// 简单的Jquery切换显示和隐藏 toggleVisibility: function() { return this.each(function() { $(this).css('display', $(this).css('display')==='none' ? 'block' : 'none'); }); }});
本文共计171个文字,预计阅读时间需要1分钟。
javascriptjQuery.fn.extend({ // 简单的Jquery全选功能 selectAll: function() { return this.each(function() { $(this).find('input[type=checkbox]').prop('checked', true); }); },
// 简单的Jquery全不选功能 deselectAll: function() { return this.each(function() { $(this).find('input[type=checkbox]').prop('checked', false); }); },
// 简单的Jquery切换选中状态 toggleSelection: function() { return this.each(function() { $(this).find('input[type=checkbox]').each(function() { $(this).prop('checked', !$(this).prop('checked')); }); }); },
// 简单的Jquery显示元素 showElement: function() { return this.each(function() { $(this).css('display', 'block'); }); },
// 简单的Jquery隐藏元素 hideElement: function() { return this.each(function() { $(this).css('display', 'none'); }); },
// 简单的Jquery切换显示和隐藏 toggleVisibility: function() { return this.each(function() { $(this).css('display', $(this).css('display')==='none' ? 'block' : 'none'); }); }});

