[jQuery] Re: text box keeps focus when another element type is clicked ?
Any good for you ... ? $(document).ready(function(){ var hasFocus = $(':text:first').focus(); $(document).bind('click', function(event){ var ev = $(event.target); if(ev != hasFocus){ if (ev.is(':text')){ hasFocus = ev; } hasFocus.focus(); } }); }); On Jun 5, 2:30 am, paulj [EMAIL PROTECTED] wrote: Hi, When a text box has the focus, I would like it to keep the focus even when another element type (not another text box) is clicked. eg after clicking this other element type, the user can press a key(s) and the text box will accept this key input without the user having to click back into the text box. Hope this makes sense. Karl gave me some info. the other day and I was pretty sure I would be able to fine-tune it for my app. but the best I could come up with is : $(document).ready(function() { $(':text').blur(function(event) { if (!$(event.target).is(':text')) { $(this).focus() } }); }); Thanks for any help Paul Here is the full code : !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd html head title/title meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 style type=text/css input { width : 700px ; } /style script type = text/javascript src=jquery.js/script script type = text/javascript $(document).ready(function() { $(':text').blur(function(event) { if (!$(event.target).is(':text')) { $(this).focus() } }); }); /script /head body ul liclick here/li lior click here/li /ul br br form input type='text' class='test' value='these text boxes should retain the focus when another element type is clicked' brbr input type='text' value='these text boxes should retain the focus when another element type is clicked' brbr input type='text' value='these text boxes should retain the focus when another element type is clicked' id='focusHere' br /form /body /html
[jQuery] Re: UI sortables problem
That is why I have posted a question here... On Jun 3, 9:19 pm, Sid [EMAIL PROTECTED] wrote: Nope, nothing happening on dragging anything On Jun 3, 5:35 pm, Arun Kumar [EMAIL PROTECTED] wrote: Not that, Drag that gadget DnD is not working... View source... On Jun 3, 5:24 pm, Sid [EMAIL PROTECTED] wrote: Didnt work on my FF 2.0.0.14 WinXP Pro SP2 at 1024x768 I clicked and small little windows with a blue minimize and a red close button opened. Inside the container, the default error page opened. On Jun 3, 12:53 pm, Arun Kumar [EMAIL PROTECTED] wrote: Please visit the URL below and let me know if there is any problem in using the jQuery UI sortables. http://tech-test.tutorialsforu.com/-Hidequoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] How to replace one word with another when it's not alone in a cell?
I want to simply replace the word comment wherever it is in a particular table. Here's my jQuery attempt: $(document).ready(function(){ $(td:contains('comment')).text(vote); }); What this does though is replace all of the text in every cell that has the word comment in it with the word vote. I just want to replace the word comment in every cell, not all of the text in every cell. Is there a way to do this with jQuery? I am doing this on a Confluence wiki if that makes any difference.
[jQuery] superfish animation (yet another )
I have recently ripped the nav down to attempt to get it to work for my own site. applying only the nav into a raw page, I still can't seem to get the animation to work in either FF or IE7. I've scoured this message group, but nothing seems to be working. Is there anything you can see in it that could be making the animation fail? test can be found here: http://agapeboardingschool.org/NEW/nav_test.html thanks
[jQuery] [validate]
Hi, Is it possible for Validate to stop on the first error it encounters? I would like to display one error at a time, rather than all errors found. Thanks, Michael
[jQuery] Re: strange error with plugin validation
This is the error that comes when i put text in the field password. jQuery.validator.methods[method] has no properties http://localhost:9090/youminiweb/js/jquery-validate/jquery.validate.js Line 467 On 4 Giu, 17:19, Jörn Zaefferer [EMAIL PROTECTED] wrote: What is thestrangeerroryou see? Please clarify. Meanwhile, this looks like it shouldn't be there: $(#joinusCompleteForm).submit(function(){ $(#joinusCompleteForm).validate(); }); Jörn On Wed, Jun 4, 2008 at 2:43 PM, k8 [EMAIL PROTECTED] wrote: Hi guys, i have thisstrangeerrorwith plugin validation. This is my code: http://rafb.net/p/L0yQZ681.html Thx @ all.
[jQuery] Can jQuery compare 2 ul and remove li's that are duplicates?
Can jQuery compare 2 ul and remove li's that are duplicates? Essentially I use jQuery to populate an unordered list with new values, and I have an existing unordered list already on the screen. I'd like to remove any elements in the newly loaded list that already exist in the current list. I hope this makes sense, and thanks in advance. Cheers, jfaulky
[jQuery] Re: Drag and Drop of Gadgets
Already asked... But got no useful response. On Jun 4, 6:42 am, Richard D. Worth [EMAIL PROTECTED] wrote: Please ask on the jQuery UI list: http://groups.google.com/group/jquery-ui - Richard On Tue, Jun 3, 2008 at 3:54 AM, Arun Kumar [EMAIL PROTECTED] wrote: Can I use sortables for div's that contains iFrames (Shindig gadgets)? that doesn't need refresh of iFrame? Inside that iFrame, I have placed a alert, and each time I drag it, I will get two alerts. Is there any way of not using a proxy element?- Hide quoted text - - Show quoted text -
[jQuery] Re: strange error with plugin validation
This is the error that comes when i put text in the field password: jQuery.validator.methods[method] has no properties http://localhost:9090/youminiweb/js/jquery-validate/jquery.validate.js Line 467 On 4 Giu, 17:19, Jörn Zaefferer [EMAIL PROTECTED] wrote: What is thestrangeerroryou see? Please clarify. Meanwhile, this looks like it shouldn't be there: $(#joinusCompleteForm).submit(function(){ $(#joinusCompleteForm).validate(); }); Jörn On Wed, Jun 4, 2008 at 2:43 PM, k8 [EMAIL PROTECTED] wrote: Hi guys, i have thisstrangeerrorwith pluginvalidation. This is my code: http://rafb.net/p/L0yQZ681.html Thx @ all.
[jQuery] Reflesh page after change DOM
dear one, I'm from China,i have a question about jQuery. When i add some elements to page,example add some li to ul,the new li don't have event that initiatory li had. I means that how to reflesh the page let all li has same event when dom changed? sorry,My poor English skills! Chinese: 当DOM结构改变以后,新加入的元素怎么才能获得原来同类元素的事件? 比如页面开始时每个LI有DRAGDROP事件,当异步AJAX添加一个LI时,怎么让这个添加的LI也有DRAGDROP事件?
[jQuery] Calling ajax onload and image problems in IE6
I am using this technique for the onload problem specified here: http://blog.outofhanwell.com/2006/06/08/the-windowonload-problem-revisited/ I have an script element defined like this: script defer src=/js/ie_onload.js/script The script file simply calls an method called init. In the init method I am making an ajax call like this: $.ajax({type: POST, url: urlToCall, data: postData, success: successCallBack, complete: function(){ stopWorking(); $('#working').hide(); }, beforeSend: function(xhr){ xhr.setRequestHeader(UseAjaxError, true); }, timeout: _ajaxTimeOut, error: errorFunction }); In the callback I am setting a div's innerHtml like this: $('#thedata').html(data); It works fine in IE7 but in IE6 all the images that are retrieved are loaded sequentially and very slowly. The status bar reads items remaining (192) and slowly counts down as each image is loaded. Has anyone experienced this and knows of a fix?
[jQuery] markReadOnly
Hello. I'm trying to make inputs readonly on click event. At the moment I'm using the inelegant onClick=markReadOnly('name') Does anyone know how I can implement this with in jQuery?
[jQuery] Re: Refactoring Functions
I think that position:fixed is not supported on IE6. Klaus Hartl escribió: On 5 Jun., 06:22, Karl Swedberg [EMAIL PROTECTED] wrote: or this ... $(document).ready(function() { stickyFooter(); $(window).resize(stickyFooter); }); How about: $(function() { $(window).resize(stickyFooter).trigger('resize'); }); You wouldn't need a named function here anymore: $(function() { $(window). resize(function() { var height = $(document).height() - 341; $('#footer').css('margin-top', height); }). trigger('resize'); }); But do you really need JavaScript at all and can't let CSS do its job? #footer { position: fixed; bottom: 0; } --Klaus
[jQuery] Re: Sorting Divs by Span Value
Something along the lines of this: div class=hotel pHotel 1br / Hotel 1 Addressbr / Hotel 1 Phone br / Distance: span class=distance5/spanmi br / Room Rate: $span class=rate125.50/span /p /div div class=hotel pHotel 2br / Hotel 2 Addressbr / Hotel 2 Phone br / Distance: span class=distance11/spanmi br / Room Rate: $span class=rate154.50/span /p /div div class=hotel pHotel 3br / Hotel 3 Addressbr / Hotel 3 Phone br / Distance: span class=distance1/spanmi br / Room Rate: $span class=rate105.50/span /p /div Of course it could be just a p with a span in it too. But that is the structure I am thinking. Thanks for any help. Regards, Seth On Jun 4, 7:51 pm, Dave Methvin [EMAIL PROTECTED] wrote: For some reason, when sorting numbers, it disregards the second number. So if I have {11,100, 500} it would sort it {100,11,500}. That is completely wrong. Looks like it's doing a character sort, at least for the data set you have there. Can you show the specific markup you'll have in this case? I think I see what you're trying to do but I want to make sure I know exactly what the markup looks like before I try some code.
[jQuery] Re: Creating and manually firing events
Hi Richard, thanks a lot for that. I've only just started using Jquery. I've just copied http://ui.jquery.com/bugs/browser/trunk/ui/tests/jquery.simulate.js and added it to my project, is that what i was supposed to do?? It works anyway. Cheers Mike On Jun 4, 1:59 pm, Richard D. Worth [EMAIL PROTECTED] wrote: What timing. Eduardo Lundgren and I have just been working on a plugin to do this to help with jQuery UI testing: http://ui.jquery.com/bugs/browser/trunk/ui/tests/jquery.simulate.js?r... No Safari 2 support at this time (since UI supports only 3+), but Eduardo said he'll add it at some point (right now we're focused on *using* the plugin). Also, we're writing utility functions. So instead of $(#foo) .simulate(mousedown, { clientX: 50, clientY: 50 }) .simulate(mousemove, { clientX: 50, clientY: 50 }) .simulate(mousemove, { clientX: 55, clientY: 55 }) .simulate(mousemove, { clientX: 60, clientY: 60 }) .simulate(mouseup, { clientX: 60, clientY: 60 }); you can simply call $(#foo).simulate(drag, { dx: 10, dy: 10 }); - Richard Richard D. Worthhttp://rdworth.org/ On Wed, Jun 4, 2008 at 3:45 AM, KayakingJoe [EMAIL PROTECTED] wrote: Hi, var myButton = dojo.byId('mybutton'); var evObjclick = document.createEvent('MouseEvents'); evObjclick.initMouseEvent( 'click', true, true, null, 0, 27, 53, 27,53, false, false, false, false, 0, null ); myButton.dispatchEvent(evObjclick); I'm looking for a cross-browser solution to the above vanilla js, which works in FF but not IE. Can you do this using jquery ? Thanks
[jQuery] Re: superfish animation (yet another )
Firebug shows errors - the first one is the problem. It seems that at some point the ampersands in the Superfish code have been encoded as $amp; which is breaking the script. Please search for this:amp;amp; and change it to this: Then it will work perfectly. Joel Birch.
[jQuery] Re: Superfish issue: statusbar URL won't show when hovering second tier links
Hi Ruud, This is interesting. I do see that behaviour in Mac Firefox although when you mouseout from a submenu and then back onto it before it disappears the status bar then does show the correct link. In Safari (also Mac) the problem you does not exist at all. I haven't checked what IE does yet. I think this behaviour may be something to do with how jQuery's .hover() function works. That's way over my head to fix, but maybe this is something that the jQuery team should have a look at? Thanks for pointing this out - sorry I couldn't be of more help. Joel Birch.
[jQuery] Re: Creating and manually firing events
Glad it works for you. If you have any issues or ideas for improvements, just let us know. - Richard On Thu, Jun 5, 2008 at 4:50 AM, KayakingJoe [EMAIL PROTECTED] wrote: Hi Richard, thanks a lot for that. I've only just started using Jquery. I've just copied http://ui.jquery.com/bugs/browser/trunk/ui/tests/jquery.simulate.js and added it to my project, is that what i was supposed to do?? It works anyway. Cheers Mike On Jun 4, 1:59 pm, Richard D. Worth [EMAIL PROTECTED] wrote: What timing. Eduardo Lundgren and I have just been working on a plugin to do this to help with jQuery UI testing: http://ui.jquery.com/bugs/browser/trunk/ui/tests/jquery.simulate.js?r... No Safari 2 support at this time (since UI supports only 3+), but Eduardo said he'll add it at some point (right now we're focused on *using* the plugin). Also, we're writing utility functions. So instead of $(#foo) .simulate(mousedown, { clientX: 50, clientY: 50 }) .simulate(mousemove, { clientX: 50, clientY: 50 }) .simulate(mousemove, { clientX: 55, clientY: 55 }) .simulate(mousemove, { clientX: 60, clientY: 60 }) .simulate(mouseup, { clientX: 60, clientY: 60 }); you can simply call $(#foo).simulate(drag, { dx: 10, dy: 10 }); - Richard Richard D. Worthhttp://rdworth.org/ On Wed, Jun 4, 2008 at 3:45 AM, KayakingJoe [EMAIL PROTECTED] wrote: Hi, var myButton = dojo.byId('mybutton'); var evObjclick = document.createEvent('MouseEvents'); evObjclick.initMouseEvent( 'click', true, true, null, 0, 27, 53, 27,53, false, false, false, false, 0, null ); myButton.dispatchEvent(evObjclick); I'm looking for a cross-browser solution to the above vanilla js, which works in FF but not IE. Can you do this using jquery ? Thanks
[jQuery] Re: jQuery 1.2.6, jqModal, IE6
I confirm this bug with ie 7 ! 2008/6/5 Stamen Georgiev [EMAIL PROTECTED]: Hi there. I'm using jqModal and the IE ActiveX started bleeding when I switched to the latest jQuery (1.2.6) It was ok with 1.2.3. Any ideas or confirmations?
[jQuery] Event propagation and anchors
This is my first post here, so hello to all subscribers! I have googled a bit for my problem, but didn't find exact answer to my problem, or I do not understand event propagation enough. The situation looks like this: I have a nested list: ul class=someclass li1 Position... a href=mailto:[EMAIL PROTECTED]e-mail/a/ li li2 Nested position ul class=nested li1.1 Position... a href=mailto:[EMAIL PROTECTED]e- mail/a/li ... /ul /li /ul There's an event (click; toggle, to be more exact) bound to each ('ul.someclass li'), making ul contained within this li (ul.nested) appear/disappear. The problem is: the event is triggered not only when I click on the 2 Nested position label, but also when clicking on any of this element (i.e. ul.someclass li) descendants, thus, preventing the default action for an anchor (mailto:[EMAIL PROTECTED]). I have made a simple workaround: $('.someclass ul li a').click(function(e) { document.location.href = $(this).attr('href'); return false; }); which works, but I'm not quite happy with the solution. The question is: is there any way to easily prevent propagation described above? I can provide a link to a live code, if needed. greetings, Jakub
[jQuery] Handling errors when ajax returns html
I have some server-side code that responds to certain ajax requests by returning the html of new rows to insert into an existing table. This works really well, but I've been thinking about ways to handle errors on the server side. By errors I mean both actual bugs, and business rule violations that mean you can't save a record (for instance). Prior ajax apps I've done have returned xml data that gets rendered by the client, not html. Each response has both data and status sections, and status does nicely for passing back errorCode, errorText, and errorDetails. In my current case, the expected ajax response is pretty specific dom content -- a set of table rows, as html. It can't just suddenly be the html of a failure alert, or an xml or json data structure, at least not with establishing some conventions about how the client can know that that's what it is. If we want to stay in the html-response domain, I was thinking of having two classes of non-dom-insert response, indicated by containing the response in a div with an agreed-upon css class. So if the response starts with div class=ajaxMsg, the client should present it as an unobtrusive msg to the user (jGrowl etc), instead of doing whatever it usually does with these responses. Similarly, if it starts with div class=ajaxError, it should be presented as a blocking, in-your-face dialog. An alternative would be for the server no to return html in these cases, but instead return xml or json with some agreed-upon structure, which the client would then package visually. That would standardize the structure and appearance of these msgs, instead of relying on server-side code to always return similar-looking content (you could standardize that on the server side instead), at the cost of encoding the info on the server and decoding it on the client, and some restriction on the structure of what you could return. A third alternative, similar to the xml/json strategy, would be for the server to deliver error/msg content as http headers, a parallel channel alongside the expected html. That's super easy to do on the server (ColdFusion back end), but so far, I haven't figure out how to access the http headers in a jQuery ajax response. (There's a separate thread here about this, no responses yet.) How do you folks generally handle this? Any best practices to follow, minefields not to fall into? Anything at all standard in jQuery, or the jQuery community? Thanks.
[jQuery] Add/remove class in Collapsor
Hi can anyone help? I've just downloaded the jQuery Collapsor demo (http:// plugins.jquery.com/project/collapsor) for use on a navigation system. I'm still a newbie with js and was wondering if anyone can point me in the right direction of how to add/remove a class to the trigger element (in this case a ul li). Basically in it's unopened state, i want to display a triangle pointing th the side, and then once clicked on, i want to display a triangle pointing downwards - i just need to be able to add/remove a class on the li as the background images will be controlled via the CSS. Any help would be greatly appreciated. The script i have at the moment is script type=text/javascript $((function(){ $('ul li a').collapsor(); })); /script Many thanks
[jQuery] Re: jQuery + jCarousel Picture Gallery working fine in Firefox but not in IE
Solved. Thanks. Naveen On Jun 4, 11:54 pm, Naveen [EMAIL PROTECTED] wrote: Hi, I'm trying to make a picture gallery using jCarousel (http://sorgalla.com/projects/jcarousel/) and other jQuery features, powered by Perl/CGI and XML at the backend. The initial version of the gallery athttp://gallery.naveeng.com/trek.html is working fine in both FF and IE. Clicking a thumbnail on the left scroller loads the corresponding image via jQuery in the main image area, while the previous, next buttons are also fine. I wrote a comments feature which enables a user to comment on individual pictures and then it appears below the main image. It can be seen athttp://gallery.naveeng.com/trek_final.htmlbut this works fine only in FF, while in IE, the initial page loads okay, but clicking a new thumbnail or any of the previous, next, first or last buttons, make IE go blank (both IE 6 and IE7)! The following are the additional changes done in the latter version, which is not working in IE: script type=text/javascript src=scripts/jquery.form.js/script script type=text/javascript src=scripts/ jquery.livequery.pack.js/script script type=text/javascript //![CDATA[ $(document).ready(function() { $('#htmlForm').livequery(function(){ $('#htmlForm').ajaxForm({ success: function(resText) { $('#htmlExampleTarget').append(resText); } }); }); }); Also, in another custom javascript function cust(), I'm using a $.ajax function to call the comments script comm_all.cgi and retrieving the comments form. But commenting out this part makes the script the work fine in IE! function cust(url) { re = /^(http:\/\/www\.naveeng\.com\/gallery\/Trek\/Canon\/Best \/)thumbs\/(.+?)_thumb(\.jpg)$/i; array=url.match(re); var xfn = Trek/data/new/ + array[2] + .xml; jQuery.get( xfn, function(data){ // jQuery(document).ready(function() { jQuery('#s_it').html(jQuery('title',data).text()); jQuery('#s_desc').html(jQuery('desc',data).text()); jQuery('#s_dt').html(jQuery('date',data).text()); jQuery('#s_pl').html(jQuery('place',data).text()); jQuery('#s_cam').html(jQuery('camera',data).text()); jQuery('#s_len').html(jQuery('lens',data).text()); jQuery('#s_fl').html(jQuery('flash',data).text()); jQuery('#s_res').html(jQuery('imgres',data).text()); jQuery('#s_sz').html(jQuery('imgsize',data).text()); jQuery('#s_or').html(jQuery('orientation',data).text()); jQuery('#s_ss').html(jQuery('ss',data).text()); // }) }, 'xml' ); var insh=a target=_blank href=' + array[1] + array[2] + array[3] + 'img src=' + array[1] + main/ + array[2] + _main + array[3] + ' border=0 //a; var inval=array[2] + _main + array[3]; gup = document.getElementById('img_name'); gup.value = inval; reg_ssi = /Trekking_Pic_(\d+)_main/i; arr_ssi = inval.match(reg_ssi); $.ajax({ type: GET, url: comm_all.cgi?pic= + arr_ssi[1], dataType: html, eval: true, error: function(){ alert('Error loading document'); }, success: function(data){ $('#ssi').html(data); } }); // jQuery(document).ready(function() { jQuery('#main_div_2').fadeOut(2000).fadeTo(10, 1, function() {jQuery('#main_img_div').html(insh);}).fadeIn(2000); // }); } So what is the problem with the above function? And how should I rewrite the $.ajax portion above so that IE doesn't go blank? Thanks. Naveen
[jQuery] $ cycle plugin crash: IE7.0.5730.13 crash - dxtrans.dll
I have a portfolio page with multiple slideshows (there are four tabs and each tab displays a different slideshow). All is well in Mozilla, but after a couple of clicks to change the tabs in IE, it chrashes. I have tried placing the code in the body of HTML, but still get the same crash!! Would appreciate some help in this matter! Here is my jQuery code: HEAD code: SCRIPT type=text/javascript $(function() { $('ul.pics').cycle({ fx:'fade', pause: 1 }); }); /SCRIPT BODY code: $(function() { // on load show tab1 $('div.gallery').hide(); $('#imgTab1').show(); $.each( [1,2,3,4], function(a, obj) { $('#imgLink' + obj).click(function() { $('div.gallery').hide(); $('#imgTab' + obj).show(); }); }); });
[jQuery] Re: Event propagation and anchors
Of course, I meant $('ul li a) instead of $('.someclass ul li a')
[jQuery] jQuery cycle plugin crash in IE7
I have a portfolio page with multiple slideshows (there are four tabs and each tab displays a different slideshow). All is well in Mozilla, but after a couple of clicks to change the tabs in IE, it chrashes. I have tried placing the code in the body of HTML, but still get the same crash!! Would appreciate some help with this issue! Here is my jQuery code: HEAD code: SCRIPT type=text/javascript $(function() { $('ul.pics').cycle({ fx:'fade', pause: 1 }); }); /SCRIPT BODY code: SCRIPT TYPE=text/javascript $(function() { // on load show tab1 $('div.gallery').hide(); $('#imgTab1').show(); $.each( [1,2,3,4], function(a, obj) { $('#imgLink' + obj).click(function() { $('div.gallery').hide(); $('#imgTab' + obj).show(); }); }); }); /SCRIPT
[jQuery] Tooltip
Hello, I am using tooltip 1.2. There is one strange behaviour. And since now i didn't find out how to avoid. Moving over a input-field the tooltip is shown as wanted. But when the mouse is dragged accidently into the input field the tooltip remains highlighted and follows the mouse over the whole screen. Only when another Tooltip is activated the 'wrong' tooltip lowlights again. Maybe you know a solution? REgards Boris
[jQuery] Re: Refactoring Functions
PS: The thing is with fixed positioning you get a *much better* experience in browsers that support it, e.g. smoother, no jumping elements/flickering. Using a resize handler is just clumsy. IE6 can be hacked away to support it, see link above. --Klaus On 5 Jun., 08:52, Javier Martínez [EMAIL PROTECTED] wrote: I think that position:fixed is not supported on IE6. Klaus Hartl escribió: On 5 Jun., 06:22, Karl Swedberg [EMAIL PROTECTED] wrote: or this ... $(document).ready(function() { stickyFooter(); $(window).resize(stickyFooter); }); How about: $(function() { $(window).resize(stickyFooter).trigger('resize'); }); You wouldn't need a named function here anymore: $(function() { $(window). resize(function() { var height = $(document).height() - 341; $('#footer').css('margin-top', height); }). trigger('resize'); }); But do you really need JavaScript at all and can't let CSS do its job? #footer { position: fixed; bottom: 0; } --Klaus
[jQuery] Re: Refactoring Functions
http://www.howtocreate.co.uk/fixedPosition.html On 5 Jun., 08:52, Javier Martínez [EMAIL PROTECTED] wrote: I think that position:fixed is not supported on IE6. Klaus Hartl escribió: On 5 Jun., 06:22, Karl Swedberg [EMAIL PROTECTED] wrote: or this ... $(document).ready(function() { stickyFooter(); $(window).resize(stickyFooter); }); How about: $(function() { $(window).resize(stickyFooter).trigger('resize'); }); You wouldn't need a named function here anymore: $(function() { $(window). resize(function() { var height = $(document).height() - 341; $('#footer').css('margin-top', height); }). trigger('resize'); }); But do you really need JavaScript at all and can't let CSS do its job? #footer { position: fixed; bottom: 0; } --Klaus
[jQuery] [autocomplete] JSON response
I am getting JSON response(string format) from the URL to which I am sending request. I want to use the methods formatResult to format the result. $(#month).autocomplete(Search.php, { minChars: 0, max: 12, autoFill: true, mustMatch: true, matchContains: false, scrollHeight: 220, formatItem: function(data, i, total) { if ( data[0] == months[new Date().getMonth()] ) return false; return data[0]; } }); Here, the Search.php will return a JSON (string format). But this plugin is looking for | symbols in the Ajax response. Where can I convert to a JSON object using eval and use it as a local JSON data?
[jQuery] date picker date range and overall minDate and maxDate
How can I set an overall min and max date having 2 dates fields as date range? That is, not only the fields should restrict each other regarding the selected dates but also BOTH FIELDS respect a min and max date. Any ideas? Thanks
[jQuery] [validate] Validating against a combination of fields
I'm trying to create a custom validation rule which works based on a pair of form fields (specifically, two select elements representing month and year, which must be a date in the future). I couldn't see any examples of this pattern in use, and wanted to ask if it was even possible? How might one go about creating a custom validation rule that did this? ~B
[jQuery] Re: Collecting info on sites using jquery.
Hi, I know the list, there is a big problem with it, It is nice looking but not filtered at all. Even the featured sites. some of them hardly uses jQuery. I was hoping that we could create a list where, we have the super featured sites, where you can see that this is how you use jQuery extensively not just some basics selector here and there. How to write usual plumbing code, to connect the components together. For example, in our project we use Tibco PageBus to do the messaging between the components and keep them separate on the page. I would like to some more examples in the direction of creating clean client side code that can scale can be reused and stays simple. Thanks for any further info. I do not know if anyone has gone through the whole list and picked up some of them which used jQuery the way it ought to be used ? Istvano On Jun 4, 3:32 pm, Seth - TA [EMAIL PROTECTED] wrote: Here is a HUGE list, enjoy -http://docs.jquery.com/Sites_Using_jQuery On Jun 4, 6:36 am, Istvan Orban [EMAIL PROTECTED] wrote: Hi All, I have been using jQuery now more then 6 months. It is amazing. Although as a Java Programmer I found it very difficult to turn my head around, and start using prototypal inheritance and all the Javascript stuff. I have checked in many Frameworks, and jQuery seemed to be the least verbose and most expressing. which was a major point when we went for jQuery. There is clear documentation how to develop plugins, also due to the YUI theatre there are plenty of info on Javascript itself as well. So My big question is, I would like to collect and also maybe put together some info on : 1, Best practises with Portlets with JQuery 2, Best practises when writting component on the page generally. - do you prefer some inheritance ( I know with jQuery this is not the best ) - use delegation I would like to see example from Real Life projects where People faced these problems and I would like to learn from why and what they have decided. so Could we put together somewhere a little list of sites and preferable links to some js files and css etc. which shows some great examples of implementation with jQuery. Any suggestions, Links, infos are very welcome. Thanks Istvano So My big question is, I would like to learn and SEE how other have used jQuery with real sites and real implementation.
[jQuery] Re: Event propagation and anchors
Hi, Not quite sure if I understood the problem - but if you mean that you only want the certain event triggered when you click on 1st-level a tags (same level as 1 Position), what you can do is use a next selector similar to: $(ul.someclass ul + li a).click({}); This way, the .click() event is attached only to all top-level a tags. The way you're selecting it now, in a sentence translates to: select all li a elements that are children of ul.someclass. Regards, Jacob On Jun 5, 8:24 am, Argasek [EMAIL PROTECTED] wrote: This is my first post here, so hello to all subscribers! I have googled a bit for my problem, but didn't find exact answer to my problem, or I do not understand event propagation enough. The situation looks like this: I have a nested list: ul class=someclass li1 Position... a href=mailto:[EMAIL PROTECTED]e-mail/a/ li li2 Nested position ul class=nested li1.1 Position... a href=mailto:[EMAIL PROTECTED]e- mail/a/li ... /ul /li /ul There's an event (click; toggle, to be more exact) bound to each ('ul.someclass li'), making ul contained within this li (ul.nested) appear/disappear. The problem is: the event is triggered not only when I click on the 2 Nested position label, but also when clicking on any of this element (i.e. ul.someclass li) descendants, thus, preventing the default action for an anchor (mailto:[EMAIL PROTECTED]). I have made a simple workaround: $('.someclass ul li a').click(function(e) { document.location.href = $(this).attr('href'); return false; }); which works, but I'm not quite happy with the solution. The question is: is there any way to easily prevent propagation described above? I can provide a link to a live code, if needed. greetings, Jakub
[jQuery] get Request doesnt work in IE7
All of a sudden, xmlhttprequests don't work no more in IE7. FF perfect, no problems. Here the simple code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head titlesome title/title meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=bin/jquery/jquery.min.js/ script script type=text/javascript $(document).ready(function(){ $.get('act/load.list.php', {kind:'contracts'}, function (data) { alert(data); }) }); /script /head body /body /html The Browser does the request, but function (data) {} is never called. This problem drives me crazy!!! Please someone help. Or is it even a browser-property problem? Thanks
[jQuery] Re: pausing a link and resuming its normal behavior
I actually found that in this case I'm using jqModal, it stops the click of the a. however, in order to make it go to where the link would be after they have done their login through jqModal, I have a form on the page that I'm submitting. Not the most elegant, but it gets the job done. On 6/4/08 9:13 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Shelane, Have you considered using a simple confirm message? For example: $('a').click(function() { var c = confirm('are you sure?'); if (!c) return false; }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 4, 2008, at 6:25 PM, Shelane wrote: If I click a link, I want to trigger a modal, and based on a response from the modal, I either want to cancel the link click or make the link be followed. Has anyone done this sort of thing or know how to accomplish it?
[jQuery] Re: Problem when trying to copy the home page design of Msn Video site
Thank you! You are really a good guy! On 6月3日, 上午1时15分, Karl Swedberg [EMAIL PROTECTED] wrote: Hi there, I'm just getting back to this list after being away for a few days, so forgive me if this has been answered already (though I didn't see a reply yet). I think you will find the hoverIntent plugin very helpful for this sort of thing: http://cherne.net/brian/resources/jquery.hoverIntent.html --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On May 29, 2008, at 5:45 AM, Jiawei wrote: This is the msn video site:http://video.msn.com/ On the home page, we can see some small preview pictures of videos.When we move the cursor over it, the picture will disappear, and some description text about the video will show up and replace the area of the original picture. When we move the cursor out of it, the picture is back again. I am trying to imitate exactly this effect. I use both of the onmouseover and onmouseout events to do that job, and it looks just as it is the real site of msn video. But there is a problem with it and I spent a whole day on it but still can't figure out a solution. The problem is: when I move the cursor in a normal speed over several preview pictures, everything is ok, but When I move the cursor over these pictures in a high speed, some of the pictures will not come back, and the replaced description texts of them are still there. It seems as if some onmouseout events failed to execute or are missing. Could someone give me some tips about how to resolve this problem?
[jQuery] Re: markReadOnly
Hi there, You can probably just set the disabled attribute to true. $('someElement').click(function() { $('someInput').attr('disabled', true); }); Hope that helps. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 5, 2008, at 6:32 AM, [EMAIL PROTECTED] wrote: Hello. I'm trying to make inputs readonly on click event. At the moment I'm using the inelegant onClick=markReadOnly('name') Does anyone know how I can implement this with in jQuery?
[jQuery] Some problems with jQuery BlockUI Plugin
I found some problems in jquery blockui plugin, I don't know whether it is my fault or the plugin's. You see the code below: html script type=text/javascript src=js/jquery-nightly.js/script script type=text/javascript src=js/jquery.blockUI.js/script script type=text/javascript function block() { $('#waitting').show(); $.blockUI({ message:$('#waitting'), css: { cursor: 'auto' } }) } function unblock() { $.unblockUI(); $('#waitting').hide(); } /script body button onclick=block()nbsp;OKnbsp;/button div id=waitting style=display:none button name=Cancel onclick=unblock()Cancel/button /div /body /html What I thought is: after the Ok button is clicked, the page is blocked and the cancel button is shown, then clicked the cancel button, the page is unbloked and the cancel button is hidden. But in fact, the demo code doesn't work as I expected: the cancel button is still there. Besides, I use cursor: 'auto', but I still got a wait cursor. Can anyone explain?
[jQuery] Re: Hide/Close div when clicked outside of it.
Hello, for those wondering, if you want to know whenever you click outside a div and byt outside i mean everywhere but the div like you want to display an error message : html head titletest error click outside/title style type=text/css p.error { position:absolute; top:40%; left:30%; width:40%; /style /head body blaeblalblpdsqdsq/pspanfsqf/span div id=onefsqfqsf/div p class=errorspanERROR :/span emClick outside this paragraph to close it, you can even click on me !/em/p div clas=fslfqs/div !-- THIS IS THE PART THAT YOU WANT TO LOOK AT ;) -- script type=text/javascript $(document).bind('click', function(e) { var $clicked=$(e.target); // get the element clicked if($clicked.is('.error') || $clicked.parents().is('.error')) { // if the element clicked is the one we're looking for or if the element has a parent that we're looking for then we clicked the right place ! console.log('BULLSEYE !'); // here you should do anything } else { // we're outside the error paragraph, no matter where but we're outside ! console.log('you clicked outside the error paragraph, congrats !'); //here you should close the message :) } }); /script /body /html This works in FF, IE7 (expect for the console.log thing ...), didnt tested it in ie6 etc... But think it works. If you just want to close it then : script type=text/javascript $(document).bind('click', function(e) { var $clicked=$(e.target); // get the element clicked if( ! ( $clicked.is('.error') || $clicked.parents().is('.error') ) ) { $('.error').hide(); } }); /script Let me know if that work for you On 2 mai, 20:35, Aleksandr [EMAIL PROTECTED] wrote: Everything is working now. Thanks to all. Last version of code is: $(document).ready(function(){ $(#link).click(function(){ if ($(#divLoginBox1).is(':hidden')) $(#divLoginBox1).show(); else{ $(#divLoginBox1).hide(); } return false; }); $('#divLoginBox1').click(function(e) { e.stopPropagation(); }); $(document).click(function() { $('#divLoginBox1').hide(); }); }); On May 2, 7:29 pm, Josh Nathanson [EMAIL PROTECTED] wrote: Looks like you are missing a semicolon which will choke IE: $(#link).click(function(){ if ($(#divLoginBox1).is(':hidden')) $(#divLoginBox1).show(); else{ $(#divLoginBox1).hide(); } return false; }) -- ADD SEMICOLON HERE -- Josh - Original Message - From: Aleksandr [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Friday, May 02, 2008 11:00 AM Subject: [jQuery] Re: Hide/Close div when clicked outside of it. I am now have this jQuery code and it is working in FireFox, Safari and Opera but not in IE 6, 7: $(document).ready(function(){ $(#link).click(function(){ if ($(#divLoginBox1).is(':hidden')) $(#divLoginBox1).show(); else{ $(#divLoginBox1).hide(); } return false; }) $('#divLoginBox1').click(function(e) { e.stopPropagation(); }); $(document).click(function() { $('#divLoginBox1').hide(); }); }); On May 2, 6:00 pm, sawmac [EMAIL PROTECTED] wrote: try this $('#divLoginBox1').click(function(e) { e.stopPropagation();}); $(document).click(function() { $('#divLoginBox1').hide(); }); --dave
[jQuery] Re: Some problems with jQuery BlockUI Plugin
I found some problems in jquery blockui plugin, I don't know whether it is my fault or the plugin's. You see the code below: html script type=text/javascript src=js/jquery-nightly.js/script script type=text/javascript src=js/jquery.blockUI.js/script script type=text/javascript function block() { $('#waitting').show(); $.blockUI({ message:$('#waitting'), css: { cursor: 'auto' } }) } function unblock() { $.unblockUI(); $('#waitting').hide(); } /script body button onclick=block()nbsp;OKnbsp;/button div id=waitting style=display:none button name=Cancel onclick=unblock()Cancel/button /div /body /html What I thought is: after the Ok button is clicked, the page is blocked and the cancel button is shown, then clicked the cancel button, the page is unbloked and the cancel button is hidden. But in fact, the demo code doesn't work as I expected: the cancel button is still there. Besides, I use cursor: 'auto', but I still got a wait cursor. Can anyone explain? You need to remove this line: $('#waitting').show(); The plugin will handle showing the message for you. Regarding the cursor, the styles you provide are applied to the message area, not the page. Mike
[jQuery] Re: jQuery cycle plugin crash in IE7
I have a portfolio page with multiple slideshows (there are four tabs and each tab displays a different slideshow). All is well in Mozilla, but after a couple of clicks to change the tabs in IE, it chrashes. I have tried placing the code in the body of HTML, but still get the same crash!! Would appreciate some help with this issue! Here is my jQuery code: HEAD code: SCRIPT type=text/javascript $(function() { $('ul.pics').cycle({ fx: 'fade', pause: 1 }); }); /SCRIPT BODY code: SCRIPT TYPE=text/javascript $(function() { // on load show tab1 $('div.gallery').hide(); $('#imgTab1').show(); $.each( [1,2,3,4], function(a, obj) { $('#imgLink' + obj).click(function() { $('div.gallery').hide(); $('#imgTab' + obj).show(); }); }); }); /SCRIPT Can you post a link?
[jQuery] Re: Mike Alsup: media plugin question
I have a suggestion and a question. The question is: Any plans for supporting the new swfobject 2.0 anytime soon? swfobject v2 support is now available: http://malsup.com/jquery/media/jquery.media.js?v.81 The following demo pages show the same markup using swfobject v1.5 and swfobject v2: http://malsup.com/jquery/media/swf1.html http://malsup.com/jquery/media/swf2.html
[jQuery] Re: Tooltip
I'm unable to reproduce the issue you describe - could you try to describe the steps necessary in a different way? Thanks Jörn On Thu, Jun 5, 2008 at 3:01 PM, casavecchio [EMAIL PROTECTED] wrote: Hello, I am using tooltip 1.2. There is one strange behaviour. And since now i didn't find out how to avoid. Moving over a input-field the tooltip is shown as wanted. But when the mouse is dragged accidently into the input field the tooltip remains highlighted and follows the mouse over the whole screen. Only when another Tooltip is activated the 'wrong' tooltip lowlights again. Maybe you know a solution? REgards Boris
[jQuery] Re: [autocomplete] JSON response
Arun Kumar ha scritto: Where can I convert to a JSON object using eval and use it as a local JSON data? I've solved this way: In the server side I create a string separated by \n chars that contains N json objects : foreach($list as $c) { $record = array(); $record['id']= $c-fields['id']; $record['comune']= ucwords(strtolower($c-fields['comune'])); $record['regione'] = ucwords(strtolower($c-fields['regione'])); $record['cap'] = $c-fields['cap']; $record['provincia'] = $c-fields['provincia']; $return[] = $record; } foreach($return as $row) { echo json_encode($row); echo \n; } and in the javascript side: $(#localita).autocomplete('ajax.php', { formatItem: function(row) { item = eval(( + row + )); return item.comune+' - '+item.cap+' - '+item.provincia+' - '+item.regione; } } Hope this helps :-) -- gianiaz.net - web solutions p.le bertacchi 66, 23100 sondrio (so) - italy +39 347 7196482
[jQuery] Re: Tooltip
Hi Emmanuel, Sorry for the delay in replying. If you include the hoverIntent plugin, then you can easily have the tooltip display after a small, configurable delay About the tooltip hiding on input focus, I wasn't aware that the tooltip got the focus when it was shown. Also, the default positioning puts the tooltip to the side of the invoking element, so it shouldn't cover it up. I don't think I'm understanding the issue entirely, though, so if you wouldn't mind clarifying, that would be great. You can certainly display only part of an ajax requested page. Probably the best way is to use the data property of the ajaxSettings option. It works the same way as the data option for $.ajax. Alternatively, you can process the response text through the ajaxProcess option. Here is the default, which strips out script, style, title, and link tags: ajaxProcess: function(data) { data = data.replace(/s(cript|tyle)(.|\s)*?\/ s(cript|tyle)/g, '').replace(/(link|title)(.|\s)*?\/(link|title)/ g,''); return data; } Hmm. that regex is pretty messy. guess I'll have to revisit that before the next release. Hope this helps --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On May 30, 2008, at 11:59 AM, Emmanuel Briot wrote: On Fri, May 30, 2008 at 5:17 PM, Karl Swedberg [EMAIL PROTECTED] wrote: You might want to take a look at my clueTip plugin. It allows you to load the contents of the tooltip with the title attribute, the text contents of an element on the current page, or the result of an ajax request. Also, in the most recent version, if you can use a string as the first argument, it will use that for the contents. Use an anonymous function and it will use the return value of that function. I like clueTip, but there are two things I wish it could do: - display the tooltips only after a small delay (configurable, although 500ms seems reasonnable) - automatically hide the tooltip whenever the mouse is pressed: if you have set the tooltip on an input field, it really should disappear when you type to give the focus to the input. Perhaps same on keypress events I am not sure, also, whether it can take only part of the loaded ajax document (similar to what load() allows). I use that in my application where I have a single file containing all the tooltip texts, and select the one I want. Since the file is cached on the client, I don't have too many http requests, and I found it more convenient for internationalization. I might, of course, have misunderstood the documentation and code, sorry if that's the case. regards Emmanuel
[jQuery] Re: [validate] Validating against a combination of fields
I've added a short explanation and an example here: http://docs.jquery.com/Plugins/Validation#Validating_multiple_fields_with_one_method Currently the example has an issue where the submitHandler is called too early/often. I'll look into it. Jörn On Thu, Jun 5, 2008 at 4:04 PM, kapowaz [EMAIL PROTECTED] wrote: I'm trying to create a custom validation rule which works based on a pair of form fields (specifically, two select elements representing month and year, which must be a date in the future). I couldn't see any examples of this pattern in use, and wanted to ask if it was even possible? How might one go about creating a custom validation rule that did this? ~B
[jQuery] Troubles with tablesorter plugin using custom parser and colspanned headers
Greetings, I'm working on a reporting system for a financial institution, so my first thought was to use tablesorter. However, one of the columns consist of img tags that show stars, and the column needs to be sorted by the number of 'stars' being shown. Since I doubt there's a custom 'stars' parser type, I decided to write my own parser that splits by the tag, and counts up the .length of the split and uses that as a value. I tested this, and much to my happiness, it worked! Then, after reviewing the spec, the header to sort by needs to be colspanned, as it covers 2 cells, the 'stars' and the number of funds associated with the stars. I thought, 'no problem! Tablesorter takes colspans into consideration when sorting!' However, when I added the colspan='2' I found that the first column with a colspan (there's 4 total) works perfectly. Every column after that is sorting by the wrong column. Specifically, it is sorting by the column consisting of the number of funds in the previous column. The only thing I can think of at the moment is that perhaps the standard parsers of 'digit', 'text', etc are running colspan checks, but custom parsers aren't subject to that. Anyone had a similar problem and/or have any insight on how to resolve it? Thanks for your assistance.
[jQuery] Photoshop to CSS code generator uses jQuery
Hi All - I've implemented an online tool that takes PSD files from Photoshop or Gimp and generates CSS/XHTML web pages automatically. It takes hints from the layer names in the PSD file and generates jQuery code to make all sorts of dynamic things happen (image roll overs, drop down and fly out menus, etc. coming soon are tooltips, a simple ajax implementation, etc. ). All the dynamic stuff uses jQuery as the engine. I was hoping that you all might take a look and offer suggestions about how to improve my current use of the awesome jQuery library or make suggestions for new features to the code generator that I could add. Here is the site: http://psd2cssonline.com Thanks for any input. -- Shaun McIntyre [EMAIL PROTECTED]
[jQuery] Re: Some problems with jQuery BlockUI Plugin
You need to remove this line: $('#waitting').show(); You don't need this line either: $('#waitting').hide();
[jQuery] Re: jQuery 1.2.6, jqModal, IE6
Please see this http://groups.google.com/group/jquery-en/browse_thread/thread/219d28208e58b85b/d8187cf1bd5104ae?lnk=gstq=jqModal#d8187cf1bd5104ae On Jun 5, 3:17 pm, Matthieu BARBE [EMAIL PROTECTED] wrote: I confirm this bug with ie 7 ! 2008/6/5 Stamen Georgiev [EMAIL PROTECTED]: Hi there. I'm using jqModal and the IE ActiveX started bleeding when I switched to the latest jQuery (1.2.6) It was ok with 1.2.3. Any ideas or confirmations?
[jQuery] Re: Tooltip
Hallo Jörn, mmh, strange, right now i cannot reproduce it myself. I will check it tomorrow again. When i recognize that effect again, i will sent a link. But it wasn't imagination. Thanks for the fast reply. Boris On 5 Jun., 17:50, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm unable to reproduce the issue you describe - could you try to describe the steps necessary in a different way? Thanks Jörn On Thu, Jun 5, 2008 at 3:01 PM, casavecchio [EMAIL PROTECTED] wrote: Hello, I am using tooltip 1.2. There is one strange behaviour. And since now i didn't find out how to avoid. Moving over a input-field the tooltip is shown as wanted. But when the mouse is dragged accidently into the input field the tooltip remains highlighted and follows the mouse over the whole screen. Only when another Tooltip is activated the 'wrong' tooltip lowlights again. Maybe you know a solution? REgards Boris
[jQuery] Handling errors when ajax returns html
[Apologies if this shows up twice; didn't see it after 5 hours+, sending again] I have some server-side code that responds to certain ajax requests by returning the html of new rows to insert into an existing table. This works really well, but I've been thinking about ways to handle errors on the server side. By errors I mean both actual bugs, and business rule violations that mean you can't save a record (for instance). Prior ajax apps I've done have returned xml data that gets rendered by the client, not html. Each response has both data and status sections, and status does nicely for passing back errorCode, errorText, and errorDetails. In my current case, the expected ajax response is pretty specific dom content -- a set of table rows, as html. It can't just suddenly be the html of a failure alert, or an xml or json data structure, at least not with establishing some conventions about how the client can know that that's what it is. If we want to stay in the html-response domain, I was thinking of having two classes of non-dom-insert response, indicated by containing the response in a div with an agreed-upon css class. So if the response starts with div class=ajaxMsg, the client should present it as an unobtrusive msg to the user (jGrowl etc), instead of doing whatever it usually does with these responses. Similarly, if it starts with div class=ajaxError, it should be presented as a blocking, in-your-face dialog. An alternative would be for the server no to return html in these cases, but instead return xml or json with some agreed-upon structure, which the client would then package visually. That would standardize the structure and appearance of these msgs, instead of relying on server-side code to always return similar-looking content (you could standardize that on the server side instead), at the cost of encoding the info on the server and decoding it on the client, and some restriction on the structure of what you could return. A third alternative, similar to the xml/json strategy, would be for the server to deliver error/msg content as http headers, a parallel channel alongside the expected html. That's super easy to do on the server (ColdFusion back end), but so far, I haven't figure out how to access the http headers in a jQuery ajax response. (There's a separate thread here about this, no responses yet.) How do you folks generally handle this? Any best practices to follow, minefields not to fall into? Anything at all standard in jQuery, or the jQuery community? Thanks.
[jQuery] Re: Reading http headers out of an ajax response
Doh, thanks. I was looking for properties, not methods. Foo on me. On Wed, Jun 4, 2008 at 7:42 PM, Karl Rudd [EMAIL PROTECTED] wrote: From a quick Google search I found (http://www.hunlock.com/blogs/AJAX_for_n00bs): # AJAX.getAllResponseHeaders() -- returns as a string all current headers in use. # AJAX.getResponseHeader(headerLabel) -- returns value of the requested header. Karl Rudd On Thu, Jun 5, 2008 at 9:32 AM, sparkpool [EMAIL PROTECTED] wrote: Sorry to be a pest, but any takers on this? Does anyone know if it's possible at all in javascript? Thanks On Wed, Jun 4, 2008 at 7:21 AM, sparkpool [EMAIL PROTECTED] wrote: Hi all, I know that jquery's ajax calls set the X-Requested-With header to 'XMLHttpRequest' for ajax requests, making it really easy for the server side to detect them. Is there any way for jquery to read the http headers out an ajax response back from the server? I can see the ones I'm interested in in the firebug console, but when I dump the XMLHttpRequest object out from inside my ajax complete method, I don't see them anywhere. Does jquery provide any tools for this? Is it possible at all in javascript? Thanks
[jQuery] Re: Event propagation and anchors
That's THE solution. It's (nearly) the same as using e.stopPropagation(). -- Ariel Flesler http://flesler.blogspot.com On 5 jun, 09:24, Argasek [EMAIL PROTECTED] wrote: This is my first post here, so hello to all subscribers! I have googled a bit for my problem, but didn't find exact answer to my problem, or I do not understand event propagation enough. The situation looks like this: I have a nested list: ul class=someclass li1 Position... a href=mailto:[EMAIL PROTECTED]e-mail/a/ li li2 Nested position ul class=nested li1.1 Position... a href=mailto:[EMAIL PROTECTED]e- mail/a/li ... /ul /li /ul There's an event (click; toggle, to be more exact) bound to each ('ul.someclass li'), making ul contained within this li (ul.nested) appear/disappear. The problem is: the event is triggered not only when I click on the 2 Nested position label, but also when clicking on any of this element (i.e. ul.someclass li) descendants, thus, preventing the default action for an anchor (mailto:[EMAIL PROTECTED]). I have made a simple workaround: $('.someclass ul li a').click(function(e) { document.location.href = $(this).attr('href'); return false; }); which works, but I'm not quite happy with the solution. The question is: is there any way to easily prevent propagation described above? I can provide a link to a live code, if needed. greetings, Jakub
[jQuery] Re: text box keeps focus when another element type is clicked ?
Wizzud, thank you for your help. Your code worked perfectly if the user had entered the text box by *clicking* on it. But, if the user has *tabbed* to the text box (and then clicks on another element) the focus is returned to the text box that was last *clicked* on. This can be seen in my example HTML. Thank you (or others) for any fine-tuning on this. Paul On 5 Jun, 09:54, Wizzud [EMAIL PROTECTED] wrote: Any good for you ... ? $(document).ready(function(){ var hasFocus = $(':text:first').focus(); $(document).bind('click', function(event){ var ev = $(event.target); if(ev != hasFocus){ if (ev.is(':text')){ hasFocus = ev; } hasFocus.focus(); } }); }); On Jun 5, 2:30 am, paulj [EMAIL PROTECTED] wrote: Hi, When a text box has the focus, I would like it to keep the focus even when another element type (not another text box) is clicked. eg after clicking this other element type, the user can press a key(s) and the text box will accept this key input without the user having to click back into the text box. Hope this makes sense. Karl gave me some info. the other day and I was pretty sure I would be able to fine-tune it for my app. but the best I could come up with is : $(document).ready(function() { $(':text').blur(function(event) { if (!$(event.target).is(':text')) { $(this).focus() } }); }); Thanks for any help Paul Here is the full code : !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd html head title/title meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 style type=text/css input { width : 700px ; } /style script type = text/javascript src=jquery.js/script script type = text/javascript $(document).ready(function() { $(':text').blur(function(event) { if (!$(event.target).is(':text')) { $(this).focus() } }); }); /script /head body ul liclick here/li lior click here/li /ul br br form input type='text' class='test' value='these text boxes should retain the focus when another element type is clicked' brbr input type='text' value='these text boxes should retain the focus when another element type is clicked' brbr input type='text' value='these text boxes should retain the focus when another element type is clicked' id='focusHere' br /form /body /html
[jQuery] Re: get Request doesnt work in IE7
Don't know if this is the problem, but you're missing a semicolon (;) after the end of your $.get function call. Carl Jan S wrote: All of a sudden, xmlhttprequests don't work no more in IE7. FF perfect, no problems. Here the simple code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head titlesome title/title meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=bin/jquery/jquery.min.js/ script script type=text/javascript $(document).ready(function(){ $.get('act/load.list.php', {kind:'contracts'}, function (data) { alert(data); }) }); /script /head body /body /html The Browser does the request, but function (data) {} is never called. This problem drives me crazy!!! Please someone help. Or is it even a browser-property problem? Thanks
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
Ever more impressive. Well done you lot, you make us proud! George
[jQuery] Calendar Over Dialog
Does anyone know if there is any combination of plugins that would allow me to use a calendar control from inside a dialog? I have tried all combinations of jQuery UI dialog and calendar, BlockUI, and jQuery datePicker. The problem is, I guess, these calendars actually *are* modal dialogs too, and they do not know how to go over top of an already active dialog. Therefore they appear underneath the active dialog where the user cannot see them.
[jQuery] Re: Calendar Over Dialog
Tim, Are you using the css file that comes with the ui.datepicker? If so, make sure the section near the top looks like this: #datepicker_div { display: none; border: 1px solid #777; z-index: ; /*must have*/ } Note the z-index set to . Compare this to the z-index of your dialog. The datepicker's z-index should be a larger number than the dialog's z-index. HTH, Carl Tim Scott wrote: Does anyone know if there is any combination of plugins that would allow me to use a calendar control from inside a dialog? I have tried all combinations of jQuery UI dialog and calendar, BlockUI, and jQuery datePicker. The problem is, I guess, these calendars actually *are* modal dialogs too, and they do not know how to go over top of an already active dialog. Therefore they appear underneath the active dialog where the user cannot see them.
[jQuery] IE6 secure nonsecure warning
Has anyone else noticed this on a site that uses jQuery or a jQuery plugin? IE7 and Firefox don't seem to complain, but IE6 does.
[jQuery] Re: superfish help
Hi Joel-! ok - found another problem. http://lhc.lucidcrew.com/ministries the first and last menu items have no sub-nav, so on rollover, it highlights the active tab and pops its subnav open. how do I avoid this from happening?
[jQuery] clueTip issue with jqueryUI
Hi, clueTips don't work with dialogs in jQueryUI. I just get regular title when I hover over the links. The code I am using for this is : HTML div id=new_a_poll class=flora title=Edit Attendance Survey Settings ?php print T_('seconds');?* a href=# onclick=return false; class=tp_tooltip title=|?php print SECONDS !!! YES SECONDS !!!;?img src=../templates/images/help.gif border=0/aBR / ?php print T_('Play audio alert');?: select name=new_a_poll_sound id=new_a_poll_sound option value=0?php print T_('No');?/option option value=0?php print T_('Yes');?/option /select a href=# onclick=return false; class=tp_tooltip title=|?php print alert the audio;?img src=../templates/images/help.gif border=0/a /div JAVASCRIPT = // Tooltips $('a.tp_tooltip').cluetip({ splitTitle: '|', showTitle: false, cluezIndex: 4000 }); I tried enabling tooltips after the dialogs are opened (in case the elements needed to be visible before it added clueTips to them) but that didn't work either. Should I add this to the bug tracker (if there is one)? Or, am I doing something wrong? Thanks in advance, Moazzam
[jQuery] Re: IE6 secure nonsecure warning
I just figured out that jquery.history_remote.pack.js is the file that seems to cause the warning message for me. When I take this jQuery plugin include file out, the message goes away. Any idea on how to fix this? I think it might have something to do with the iframe part of this plugin.
[jQuery] Trying to write a MacFF2 Transparency Fix - Need help with .version
Here is my code: // Mac FireFox 2 Transparent Background Fix if ($.browser.mozilla (browser.version 3.0)) { $(function(){ alert('This is FireFox 2!'); $('body').css('background', 'red'); }); } I think that .version is blowing up the script. Can someone help me with what I am doing? Lemme know what I missed. Thanks. Dave
[jQuery] Re: help with array for flot
$('#plot').click(function() { var d1 = []; $('#curveData tbody tr').each(function() { tr = $(this); pair = []; tr.find('input.qty').val() tr.find('input.price').val() pair.push( tr.find('input.qty').val(), tr.find('input.price').val() ) d1.push( pair ); }); $.plot($(#graphHolder), [ { color: #bb, data: d1, points: { show: true }, lines: { show: true } } ]); });
[jQuery] Re: help with array for flot
aquaone thank you! I need to do a little reading up on what .push does rolf On Jun 5, 2008, at 3:09 PM, aquaone wrote: $('#plot').click(function() { var d1 = []; $('#curveData tbody tr').each(function() { tr = $(this); pair = []; tr.find('input.qty').val() tr.find('input.price').val() pair.push( tr.find('input.qty').val(), tr.find('input.price').val () ) d1.push( pair ); }); $.plot($(#graphHolder), [ { color: #bb, data: d1, points: { show: true }, lines: { show: true } } ]); });
[jQuery] JSON and each loop
This is a working sample, but I would like to use a dynamic variable selected_country within the each loop at the end. Like: data.selected_country. However, if I use this it takes it literally and thus does not find selected_country in the JSON. It would be nice to find and only return US, UK, etc. from the JSON. JS: var $select_country = $('select[name=country]').get()[0]; var $select_state = $('select[name=state]').get()[0]; var selected_country = 'US'; $($select_country).change(function() { selected_country = $select_country.value; }); $.getJSON('/portal/js/lib/state.json',function(data) { $.each(data.US, function(key,state) { $($select_state).append('option value=' + key + '' + state + '/ option'); }); }); JSON: { 'US' : { 'AK' : 'Alaska', 'AL' : 'Alabama'}, 'CA' : {'AB' : 'Alberta', 'MB' : 'Manitoba'} } Any suggestions? Thanks.
[jQuery] Making normal functions work with jQuery
I have two functions that convert an ISO date into whatever date format I want. Currently I am using a document.write statement to write out each date, but I don't want to do that anymore. I want to make it unobtrusive, and have jquery find a class selector, and replace the content. So, my question is, how can I combine my functions that I already have created, and have it work with jQuery, so that it can look for a specific class, which contains the ISO date, and replace that? Date.prototype.customFormat=function(formatString){ var ,YY,,MMM,MM,M,,DDD,DD,D,hhh,hh,h,mm,m,ss,s,ampm,dMod,th; YY = ((=this.getFullYear())+).substr(2,2); MM = (M=this.getMonth()+1)10?('0'+M):M; MMM = (=[January,February,March,April,May,June,July,August,September,October,November,December] [M-1]).substr(0,3); DD = (D=this.getDate())10?('0'+D):D; DDD = (=[Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday] [this.getDay()]).substr(0,3); th=(D=10D=20)?'th':((dMod=D%10)==1)?'st':(dMod==2)?'nd': (dMod==3)?'rd':'th'; formatString = formatString.replace(##,).replace(#YY#,YY).replace(##,).replace(#MMM#,MMM).replace(#MM#,MM).replace(#M#,M).replace(##,).replace(#DDD#,DDD).replace(#DD#,DD).replace(#D#,D).replace(#th#,th); h=(hhh=this.getHours()); if (h==0) h=24; if (h12) h-=12; hh = h10?('0'+h):h; ampm=hhh12?'am':'pm'; mm=(m=this.getMinutes())10?('0'+m):m; ss=(s=this.getSeconds())10?('0'+s):s; return formatString.replace(#hhh#,hhh).replace(#hh#,hh).replace(#h#,h).replace(#mm#,mm).replace(#m#,m).replace(#ss#,ss).replace(#s#,s).replace(#ampm#,ampm); } getTFID=function(isoDate){ //GET TIME FROM ISO DATE if(isoDate.slice(-1)=='-') return ''; isoDate = isoDate.replace(/\D/g, ); var dObj = isoDate.split( ); var newDate = new Date(dObj[0], (dObj[1]-1), dObj[2], dObj[3], dObj[4], dObj[5]); return newDate.customFormat('#h#:#mm##ampm#');
[jQuery] click function doesn't work on dynamic content?
Hi there, Please see my example here: http://www.hellobenlau.net/jquery/test.htm So basically, I want to select a list item from Group A, and when the transfer button is clicked, it gets transfered to Group B. However, once transferred, the list items in Group B doesn't respond to any click function called OUTSIDE of the 'transfer' function. Im not sure if i'm explaining it properly, but this is my code: $(document).ready(function(){ var temp; // selecting $('li').click(function(){ $('li.highlight').removeClass('highlight'); $(this).addClass('highlight'); temp = $(this).text(); }); // when transfer link is clicked $('#transfer').click(function(){ $('#groupA li.highlight').remove(); $('#groupB').append('li' + temp + '/li'); }); }); Any help would be extremely helpful! Thanks!!
[jQuery] String Manipulation
Is there a good string manipulation library plugin? Something that might have .split()
[jQuery] Re: Trying to write a MacFF2 Transparency Fix - Need help with .version
You need that dollar sign, a la if ($.browser.mozilla $.browser.version 3.0) -- Josh - Original Message - From: [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, June 05, 2008 2:38 PM Subject: [jQuery] Trying to write a MacFF2 Transparency Fix - Need help with .version Here is my code: // Mac FireFox 2 Transparent Background Fix if ($.browser.mozilla (browser.version 3.0)) { $(function(){ alert('This is FireFox 2!'); $('body').css('background', 'red'); }); } I think that .version is blowing up the script. Can someone help me with what I am doing? Lemme know what I missed. Thanks. Dave
[jQuery] jQuery allow encoding into json?
could not find a function for it. Will be creating a complicated js object on client side. Want to encode that object into json, and stuff the value into a hidden form field for POST. anybody help a nubie?
[jQuery] Thickbox on 1.2.6 or best alternative?
What are people using today to create effects like thickbox or lightbox on jQuery 1.2.6? Thickbox is broken on the 1.2.x release and I'm stuck with an old version of jQuery until I find a suitable replacement. What are others using? -- Shane ∞ http://liquid.homelinux.org - I'm so cool I can be used to prove Bose-Einstein Condensation!
[jQuery] Re: Sorting Divs by Span Value
Wrap that html in a div id=hotels /div and try this code triggered by a button or link. function reorder(sortby, direction) { Array.prototype.sort.call($(div.hotel), function(a,b){ var av = $(a).find(span.+sortby).text(); var bv = $(b).find(span.+sortby).text(); return direction==ascending? av-bv : bv-av; }).appendTo(#hotels); } sortby is the class name of any of the spans like distance or rate; direction is ascending (low to high) or descending. The code assumes the spans should always be sorted as numeric values. That code should be plenty fast for a dozen or so entries, but it would get slow for 100 because it requeries for the span values on each sort comparison.
[jQuery] Re: String Manipulation
Errr JavaScript has a string split function: http://www.w3schools.com/jsref/jsref_split.asp Karl Rudd On Fri, Jun 6, 2008 at 9:50 AM, Mike [EMAIL PROTECTED] wrote: Is there a good string manipulation library plugin? Something that might have .split()
[jQuery] Re: click function doesn't work on dynamic content?
Take a look at: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F If I've understood you're problem, it's a fairly common one that stems from the fact that you're adding a new element (with append('li ...) that has no click event bound to it. The article linked above has a full explanation and some good solutions. - Richard Richard D. Worth http://rdworth.org/ On Thu, Jun 5, 2008 at 7:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, Please see my example here: http://www.hellobenlau.net/jquery/test.htm So basically, I want to select a list item from Group A, and when the transfer button is clicked, it gets transfered to Group B. However, once transferred, the list items in Group B doesn't respond to any click function called OUTSIDE of the 'transfer' function. Im not sure if i'm explaining it properly, but this is my code: $(document).ready(function(){ var temp; // selecting $('li').click(function(){ $('li.highlight').removeClass('highlight'); $(this).addClass('highlight'); temp = $(this).text(); }); // when transfer link is clicked $('#transfer').click(function(){ $('#groupA li.highlight').remove(); $('#groupB').append('li' + temp + '/li'); }); }); Any help would be extremely helpful! Thanks!!
[jQuery] Re: jQuery allow encoding into json?
You want: http://docs.jquery.com/Ajax/serializeArray Karl Rudd On Fri, Jun 6, 2008 at 10:15 AM, Mark [EMAIL PROTECTED] wrote: could not find a function for it. Will be creating a complicated js object on client side. Want to encode that object into json, and stuff the value into a hidden form field for POST. anybody help a nubie?
[jQuery] jquery-1.2.6.pack.js broken?
Attempting to use jquery-1.2.6.pack.js linked from http://docs.jquery.com/Downloading_jQuery resulted in a lot of $ is not defined errors for me. The good news is using http://dean.edwards.name/packer/ to pack the uncompressed version ( jquery-1.2.6.js ) worked nicely. Perhaps a problem with the published packed version? Cheers Ollie
[jQuery] Re: Thickbox on 1.2.6 or best alternative?
Shane, Check out this one: http://leandrovieira.com/projects/jquery/lightbox/ Rey Shane Graber wrote: What are people using today to create effects like thickbox or lightbox on jQuery 1.2.6? Thickbox is broken on the 1.2.x release and I'm stuck with an old version of jQuery until I find a suitable replacement. What are others using?
[jQuery] Re: jQuery allow encoding into json?
could not find a function for it. Will be creating a complicated js object on client side. Want to encode that object into json, and stuff the value into a hidden form field for POST. anybody help a nubie? Here's some links: http://jollytoad.googlepages.com/json.js http://www.overset.com/2008/04/11/mark-gibsons-json-jquery-updated/ http://code.google.com/p/jquery-json/
[jQuery] Re: jQuery allow encoding into json?
*http://mg.to/2006/01/25/json-for-jquery http://www.mail-archive.com/[EMAIL PROTECTED]/msg06247.html the second is a port of the original from json.org, I use that for my JSON requests. * On Thu, Jun 5, 2008 at 5:15 PM, Mark [EMAIL PROTECTED] wrote: could not find a function for it. Will be creating a complicated js object on client side. Want to encode that object into json, and stuff the value into a hidden form field for POST. anybody help a nubie? -- http://morglog.alleycatracing.com Lets make up more accronyms! http://www.alleycatracing.com LTABOTIIOFR! ROFL! ROFL! ROFL! Upcoming alley cats, reviews, touring logs, and a general congregation of bike nerdity.
[jQuery] Re: jQuery allow encoding into json?
Woops, sorry, wrong direction. You want to produce a string version to stuff into the field. The method I suggested pulls it's data from a form into a JSON form (but not the string you're looking for). Try the stringify method from here: http://www.json.org/js.html Karl Rudd On Fri, Jun 6, 2008 at 10:15 AM, Mark [EMAIL PROTECTED] wrote: could not find a function for it. Will be creating a complicated js object on client side. Want to encode that object into json, and stuff the value into a hidden form field for POST. anybody help a nubie?
[jQuery] Re: Reading http headers out of an ajax response
Um, just for the record, I did actually google various things, on more than one occasion.. On Thu, Jun 5, 2008 at 1:28 PM, sparkpool [EMAIL PROTECTED] wrote: Doh, thanks. I was looking for properties, not methods. Foo on me. On Wed, Jun 4, 2008 at 7:42 PM, Karl Rudd [EMAIL PROTECTED] wrote: From a quick Google search I found (http://www.hunlock.com/blogs/AJAX_for_n00bs): # AJAX.getAllResponseHeaders() -- returns as a string all current headers in use. # AJAX.getResponseHeader(headerLabel) -- returns value of the requested header. Karl Rudd On Thu, Jun 5, 2008 at 9:32 AM, sparkpool [EMAIL PROTECTED] wrote: Sorry to be a pest, but any takers on this? Does anyone know if it's possible at all in javascript? Thanks On Wed, Jun 4, 2008 at 7:21 AM, sparkpool [EMAIL PROTECTED] wrote: Hi all, I know that jquery's ajax calls set the X-Requested-With header to 'XMLHttpRequest' for ajax requests, making it really easy for the server side to detect them. Is there any way for jquery to read the http headers out an ajax response back from the server? I can see the ones I'm interested in in the firebug console, but when I dump the XMLHttpRequest object out from inside my ajax complete method, I don't see them anywhere. Does jquery provide any tools for this? Is it possible at all in javascript? Thanks
[jQuery] Re: Making normal functions work with jQuery
So, my question is, how can I combine my functions that I already have created, and have it work with jQuery, so that it can look for a specific class, which contains the ISO date, and replace that? If you used markup like this: span class=ISODate2008-06-05T20:35Z/span You could replace the ISO dates with another format using this: $(span.ISODate).each(function(){ $(this).text(getTFID($(this).text())); });
[jQuery] Re: JSON and each loop
This is a working sample, but I would like to use a dynamic variable selected_country within the each loop at the end. Like: data.selected_country. However, if I use this it takes it literally and thus does not find selected_country in the JSON. It would be nice to find and only return US, UK, etc. from the JSON. Instead of data.US, just say data[selected_country] and it will pick the right one.
[jQuery] Datepicker: convert date string back to date?
Does anyone know if there is a way to convert datepicker's generated date range string back to a suitable date format I can use to provide values for minDate and maxDate? Thanks!
[jQuery] Re: Some problems with jQuery BlockUI Plugin
It worked! Now I realized that the plugin can show the hidhen element automatically, so I don't need to show or hide it by myself. Thanks! On Jun 6, 12:34 am, Mike Alsup [EMAIL PROTECTED] wrote: You need to remove this line: $('#waitting').show(); You don't need this line either: $('#waitting').hide();
[jQuery] Re: JSON and each loop
Duh! Thank you. I tried that earlier, but i left the ., data. [selected_country] and it would error out.