jquery-1.7

What does delegation do versus a plain on('click',…)?

ぐ巨炮叔叔 提交于 2019-12-30 07:00:25
问题 What is the different in performance and the handling of these two different jQuery statements: Number One : $('#selector1, #selector2, .class1').on('click', function () { //stuff }); Number Two : $(document).on('click', '#selector1, #selector2, .class1', function () { //stuff }); I know that one does delegation and the other doesn't. But what does that mean? Don't both do some sort of action when you click on '#selector1, #selector2, .class1' ? In the end, isn't it the same? 回答1: Number One

Cannot break recursion with $.Deffered() object and $.then()

谁说我不能喝 提交于 2019-12-24 23:16:03
问题 I have to search through word index tables with potentially hundreds of thousands rows. I can restrict my search by passing a list of documents to the search. Request to search for words in many documents return very slowly. So...to improve the UX we're chunking the request into several groups of documents. So, if a user asks to search 90 documents, and the chunk size is 10 documents per query, then we send out 90 / 10 = 9 independent $.ajax() calls. We want the results to come in the order

Check if any ancestor has a class using jQuery

情到浓时终转凉″ 提交于 2019-12-17 17:25:23
问题 Is there any way in jQuery to check if any parent, grand-parent, great-grand-parent has a class. I have a markup structure that has left me doing this sort of thing in the code: $(elem).parent().parent().parent().parent().hasClass('left') However, for code readability i'd like to avoid this sort of thing. Is there any way to say "any parent/grandparent/great-grand-parent has this class"? I am using jQuery 1.7.2. 回答1: if ($elem.parents('.left').length) { } 回答2: There are many ways to filter

JQuery .on() method with multiple event handlers to one selector

不打扰是莪最后的温柔 提交于 2019-12-17 02:33:27
问题 Trying to figure out how to use the Jquery .on() method with a specific selector that has multiple events associated with it. I was previously using the .live() method, but not quite sure how to accomplish the same feat with .on(). Please see my code below: $("table.planning_grid td").live({ mouseenter:function(){ $(this).parent("tr").find("a.delete").show(); }, mouseleave:function(){ $(this).parent("tr").find("a.delete").hide(); }, click:function(){ //do something else. } }); I know I can

JQuery 1.7 breaks JQuery Datepicker?

蓝咒 提交于 2019-12-12 02:47:48
问题 One of the best datepickers around these days I think is still Kelvin Luck's jquery-datepicker http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/ However, the latest jquery (jquery 1.7+) breaks this datepicker silently. I was just wondering if anyone has looked into the issue, or how we can fix this potentially 回答1: I prefer to use the datepicker from jquery-ui, I don't know if it is different but it seems more in sync with jquery releases, has a larger user base and developer pool.

Is jQuery BBQ-Plugin still working with JQuery 1.7x?

情到浓时终转凉″ 提交于 2019-12-11 03:39:43
问题 Short question, but couldn't find a hint to that anywhere: it seems that the jQuery BBQ Plugin is only tested to work with jQuery until v1.4.2. Now the current version of jQuery is v1.7.1 and i wonder if the Plugin will be still working? Haven't used it before and just want to avoid wasting time hopelessly in getting it working... 回答1: I know this is an old thread, but just in case anyone comes across it like I have - I'm using jQuery 1.9.1 and just by including the jQuery BBQ plugin I get a

reset value of multiple (but not all) form fields with jQuery in one line

我是研究僧i 提交于 2019-12-10 16:29:18
问题 Is it possible to reset multiple form fields in one line, or one hit, with jQuery. Note: I don't want to reset all form fields, only a specified whitelist (as below): // reset some form fields $('#address11').val(''); $('#address21').val(''); $('#town1').val(''); $('#county1').val(''); $('#postcode1').val(''); 回答1: jQuery (and CSS) selector strings can contain multiple selectors using a comma as a delimiter for sub-selectors: $('#address11, #address21, #town1, #county1, #postcode1').val('');

jQuery 1.7 clientX/pageX undefined

流过昼夜 提交于 2019-12-06 01:52:37
问题 I use jQuery and draggable from jqueryUI. When I update jQuery from 1.6 to 1.7 clientX and pageX attributes disappeared from event variable. Here is an example: http://jsbin.com/ezulas/7/edit If in given example jQuery version is changed to 1.6.4 - it starts working. With latest release - both clientX/Y and pageX/Y are not working. I discovered I can use e=e.originalEvent - but that doesn't seems to be the proper solution. 回答1: event.layerX and event.layerY: We have removed these non-standard

jQuery 1.7 clientX/pageX undefined

拟墨画扇 提交于 2019-12-04 06:04:12
I use jQuery and draggable from jqueryUI. When I update jQuery from 1.6 to 1.7 clientX and pageX attributes disappeared from event variable. Here is an example: http://jsbin.com/ezulas/7/edit If in given example jQuery version is changed to 1.6.4 - it starts working. With latest release - both clientX/Y and pageX/Y are not working. I discovered I can use e=e.originalEvent - but that doesn't seems to be the proper solution. event.layerX and event.layerY: We have removed these non-standard properties in version 1.7. Although we normally would have gone through a deprecation notice period for

When would I use JQuery.Callbacks?

≯℡__Kan透↙ 提交于 2019-12-03 00:42:52
问题 I was looking through new stuff added to jQuery 1.7 and I saw they now have jQuery.Callbacks() http://api.jquery.com/jQuery.Callbacks/. The documentation shows you how to use jQuery.callbacks() but not any applicable examples of when I would want to use them. It seems you can add/remove callbacks from a callbacks list and you can do jQuery.callbacks().fire(args), but this just fires off ALL of the callbacks in that list. Maybe I am missing something but this doesn't seem very useful. In my