jquery-1.4

jQuery 1.4 change event bug in IE

纵然是瞬间 提交于 2019-12-07 01:21:34
问题 I have this simple select: <select name="zlecenia_index_icpp" id="items_per_page"> <option value="10">10</option> <option value="25" selected="selected">25</option> <option value="50">50</option> </select> and on it there's: $('#items_per_page').change(function(){ var controller_action = this.name.replace(/_/g, '/'); location.href = config.base_url + '/' + controller_action + '/'+this.value; }); It used to work in jQuery 1.3, but in 1.4 the change event is fired as soon as I click on the

jQuery 1.4.2 Using .delegate() on a change event for a doropdown list

元气小坏坏 提交于 2019-12-06 17:49:27
My problem is that I am not sure how to use .delegate for the following scenario: our application has a voting system to which several rounds or steps can be added. every time a new step is added there is a list of options that defines how the round/step is to be won. <select class="listOfOptions"> <option value="U">Unanimous</option> <option value="M">Majority</option> <option value="C" class="customOption"># of votes…</option> </select> now when an option is selected the following code runs $(document).ready(function() { $('.listOfOptions').live('change', function() { if ($(this).find('

Custom validator fires but does not prevent postback

断了今生、忘了曾经 提交于 2019-12-05 08:13:14
I've seen a lot of questions about this already, but I'm stumped! Please help! I have a customvalidator. It's firing but it's not preventing postback. Please help me in doing so! I can see that console.log registers before the post. But, it posts back anyway. How do I prevent the postback? I've tried adding a control to validate, and validate empty text equal to true. I also tried adding e.preventdefault, which did not work :( How can I prevent the postback? <script type="text/javascript"> //<![CDATA[ function validateWhyUnlikely(source, args) { console.log(1); args.isValid = false; } //]]>

jQuery Animate Padding to Zero

浪尽此生 提交于 2019-12-03 23:39:41
问题 I have the following snippet that toggles padding when hovering (see example here): <div id="outer"><div id="inner"></div></div> <script> $("#inner").mouseenter(function () { $("#outer").animate({ 'padding' : '20px' }, "slow"); }); $("#inner").mouseleave(function () { $("#outer").animate({ 'padding' : '0px' }, "slow"); }); </script> The goal is to have the padding animate both in and out, however currently no animation appears for animating out. I did some tests, and if I change the leave

What real purpose does $.noop() serve in jQuery 1.4?

落爺英雄遲暮 提交于 2019-12-03 14:23:21
问题 Pouring over the release notes regarding jQuery 1.4, I came acrosss $.noop() which is: Description : An empty function. (added in 1.4) You can use this empty function when you wish to pass around a function that will do nothing. Perhaps I'm missing something profound here, but what exactly is a practical use of passing around an empty function? Code examples appreciated. 回答1: This function was proposed due to performance issues on embedded systems when using $.ajax , reported on the jQuery

What real purpose does $.noop() serve in jQuery 1.4?

两盒软妹~` 提交于 2019-12-03 05:13:55
Pouring over the release notes regarding jQuery 1.4, I came acrosss $.noop() which is: Description : An empty function. (added in 1.4) You can use this empty function when you wish to pass around a function that will do nothing. Perhaps I'm missing something profound here, but what exactly is a practical use of passing around an empty function? Code examples appreciated. CMS This function was proposed due to performance issues on embedded systems when using $.ajax , reported on the jQuery-Dev mailing list. You can see the thread . Basically, they preferred to introduce and use this single

Calling $().focus on a textarea in Firefox doesn't work as expected

折月煮酒 提交于 2019-12-01 14:55:29
I've reproduced the problem here: http://jsfiddle.net/Rc52x/5/ If you click on Click here! while using Chrome, the textarea gains focus and you can start typing as expected. If you click on it while using Firefox (I'm using 3.6.15 right now), the textarea does NOT gain focus and typing does nothing. What the heck? You need to prevent the default action of the link: http://jsfiddle.net/JAAulde/Rc52x/7/ Firefox is following it causing the textarea to lose focus after gaining. This works: $(document).ready(function () { $("a#focus").click(function(e) { $("#Body").focus(); return false; }); });

Calling $().focus on a textarea in Firefox doesn't work as expected

坚强是说给别人听的谎言 提交于 2019-12-01 12:36:20
问题 I've reproduced the problem here: http://jsfiddle.net/Rc52x/5/ If you click on Click here! while using Chrome, the textarea gains focus and you can start typing as expected. If you click on it while using Firefox (I'm using 3.6.15 right now), the textarea does NOT gain focus and typing does nothing. What the heck? 回答1: You need to prevent the default action of the link: http://jsfiddle.net/JAAulde/Rc52x/7/ Firefox is following it causing the textarea to lose focus after gaining. 回答2: This

jquery live hover

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 18:19:11
I'm using the following jquery code to show a contextual delete button only for table rows we are hovering with our mouse. This works but not for rows that have been added with js/ajax on the fly... Is there a way to make this work with live events? $("table tr").hover( function () {}, function () {} ); Philippe Leybaert jQuery 1.4.1 now supports "hover" for live() events, but only with one event handler function: $("table tr").live("hover", function () { }); Alternatively, you can provide two functions, one for mouseenter and one for mouseleave: $("table tr").live({ mouseenter: function () {