阻止默认事件触发

This commit is contained in:
Argo-Lenovo 2017-01-15 13:59:13 +08:00
parent 841fd90b2e
commit 0195b8cd5f
1 changed files with 2 additions and 1 deletions

View File

@ -331,7 +331,8 @@
var $select = $element.find('button').first(); var $select = $element.find('button').first();
var $options = $element.find('.dropdown-menu > li > a'); var $options = $element.find('.dropdown-menu > li > a');
$select.addClass('select').data('options', $options); $select.addClass('select').data('options', $options);
$options.on('click', function () { $options.on('click', function (e) {
e.preventDefault();
var $op = $(this); var $op = $(this);
$select.text($op.text()).attr('data-val', $op.attr('data-val')); $select.text($op.text()).attr('data-val', $op.attr('data-val'));
}); });