jQuery模糊函数被调用两次

时间:2015-07-11 07:54:09

标签: jquery



<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 location_detail" style="clear:none !important;">
            <div class="col-xs-12 txt_selectd_location">Selected Locations
              <div class="col-xs-3 pull-right">Qty.</div>
            </div>
            <div id="changeCont" class="col-xs-12 pad0">
              <div class="col-xs-12 unallocate-amount">
                <div class="col-xs-8 pad0 bold">Unallocated</div>
                <div class="col-xs-3 pull-right" id="unallocated-stcok-display">200</div>
                <input type="hidden" id="unallocated-stcok" value="200">
              </div>
                            <div class="location_row">
                <div class="city">
                  Ahmedabad                </div>
                                <div class="city_square square-left"></div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="3" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Bangalore                </div>
                                <div class="city_square square-left"></div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="2" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Chennai                </div>
                                <div class="city_square square-left"></div>
                                <input type="text" id="6" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Kolkata                </div>
                                <div class="city_square square-left"></div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="16" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Kolkata                </div>
                                <div class="city_square square-left"></div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="17" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Mumbai                </div>
                                <div class="city_square square-left"></div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="4" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Pune                </div>
                                <div class="city_square square-left"></div>
                                <input type="text" id="5" value="0" class="input-in-out share-stock">
              </div>
                            <div class="location_row">
                <div class="city">
                  Vadodara                </div>
                                <div class="city_square square-right"></div>
                                <input type="text" id="22" value="0" class="input-in-out share-stock">
              </div>
                          </div>
          </div>
&#13;
&#13;
&#13;

jQuery模糊函数调用两次。如何防止模糊功能从两次调用它。我正在调用模糊函数来计算用户给出的输入输入字段在弹出窗口中。当我输入一些值到输入字段并点击&#39; Tab&#39;我发现控制台在这里打印了两次。每次我点击标签时,它都会多次迭代事件。

我的代码是:

jQuery(document).on('blur', 'input.share-stock', function(e){
    e.preventDefault();
    console.log('here');
});

0 个答案:

没有答案