如何防止触发功能上的页面刷新?

时间:2017-02-10 12:24:36

标签: javascript jquery html

每当我点击列表时页面都会刷新,这是由于触发器,但我不希望页面刷新

 base.$rootElement.data('val',dataArr.toString()).trigger('data-value-change');

 $(window).click(function(e) {
     console.log('window clicked'); 
     base.$optionTray.hide();
});

this.filterElByTagnew.on('data-value-change', function (e) {  self.cummulativeOnChangeHandler(); });

// HTML

<div class="js-multiselectDropdown">
    <div style="background-color: white">
        <div class="action-btn " data-action="colex"><span>Choose Tag</span></div>

        <div class="eG2Col list-show" data-action="option-tray">
            <ul></ul>
        </div>

        <div data-action="checkbox-tray" class="hidden">
            <input type="checkbox" value="5G" />5G</br>
            <input type="checkbox" value="Connectivity"  />Connectivity</br>
            <input type="checkbox" value="Digital transformation" />Digital transformation</br>
            <input type="checkbox" value="Radio system"  />Radio system</br>
            <input type="checkbox" value="Mobile"  />Mobile</br>

        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

尝试

 $(window).click(function(e) {
    console.log('window clicked'); 
    base.$optionTray.hide();
    e.preventDefault(); 
 });