[jQuery] Re: Check if window exists before opening
this is some I am thinking about and an approach that I may take, have'nt got to that stage yet but window.closed looks good http://bytes.com/forum/thread91209.html 2008/7/3 Bruce MacKay [EMAIL PROTECTED]: More searching has led me to a solution, and another question $(a.openW).click( function(e) { var sTarget = this.href; if (winRef ! winRef.closed){ winRef.focus(); }else { winRef=window.open(sTarget); } // or do I mean stopProgation e.preventDefault(); }); This code does the necessary check, but it won't move focus to the existing opened window (that contains the help file). What am I not doing correctly? Thanks, Bruce At 01:11 p.m. 3/07/2008, you wrote: Hello folks, I can't find the answer I need in the archives (Nabble), so my question is how do I check to see if a window exists before I open it? When a user of my application clicks on a help link, I want the help file to load into a new window. I'm doing that via... $(a.openW).click( function() { window.open(this.href); return false; }); But I want to first make sure that a window containing the help file isn't already open before a new one (another one) is opened. Help/direction appreciated. Thanks, Bruce
[jQuery] Re: Check if window exists before opening
On Thu, Jul 3, 2008 at 8:17 AM, Sam Sherlock [EMAIL PROTECTED] wrote: this is some I am thinking about and an approach that I may take, have'nt got to that stage yet but window.closed looks good http://bytes.com/forum/thread91209.html 2008/7/3 Bruce MacKay [EMAIL PROTECTED]: More searching has led me to a solution, and another question $(a.openW).click( function(e) { var sTarget = this.href; if (winRef ! winRef.closed){ winRef.focus(); }else { winRef=window.open(sTarget); } // or do I mean stopProgation e.preventDefault(); }); This code does the necessary check, but it won't move focus to the existing opened window (that contains the help file). What am I not doing correctly? Thanks, Bruce At 01:11 p.m. 3/07/2008, you wrote: Hello folks, I can't find the answer I need in the archives (Nabble), so my question is how do I check to see if a window exists before I open it? When a user of my application clicks on a help link, I want the help file to load into a new window. I'm doing that via... $(a.openW).click( function() { window.open(this.href); return false; }); But I want to first make sure that a window containing the help file isn't already open before a new one (another one) is opened. Help/direction appreciated. Thanks, Bruce According to this code, i think you should simply reference the variable holding the window.open result in a wider scope, and you won't have to check: it will use the same window name property: var winRef = null; $(a.openW).click( function(e) { var sTarget = this.href; winRef=window.open(sTarget); // or do I mean stopProgation e.preventDefault(); });
[jQuery] Re: Shadowbox 2.0rc1
Normally I'd agree, but the real problem isn't so much the cost as the bureaucracy involved in licensing software here, even if it only does cost $20. I tried to talk the boss into making a donation to jQuery on the grounds that it's getting more and more use on our site, the development effort deserved acknowledgement and it couldn't hurt publicity wiae, but while he agreed he turned me down because the paperwork would have been rejected. On Jul 2, 3:46 pm, Rick Faircloth [EMAIL PROTECTED] wrote: I don't see why you can't download the free version for testing and then demo it to your boss. If he/she wants it, $20 can be found. (And if your boss can't find $20 extra dollars, you might want to abandon that sinking ship! One less pizza and you've got a great plug-in! :o) Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gordon Sent: Wednesday, July 02, 2008 4:19 AM To: jQuery (English) Subject: [jQuery] Re: Shadowbox 2.0rc1 I was having a few problems with the first shadowbox and was interested to see if there were additions that would get me around them, but it seems the license has changed and I don't think I can get my employer to fork out for a license as money is currently very tight. On Jul 1, 5:44 pm, Michael J. I. Jackson [EMAIL PROTECTED] wrote: If you're using the Shadowbox jQuery plugin, it has been updated. The new version features increased flexibility and stability for various media types. It also includes much better support for i18n and skinning. Just wanted to let you know in case you are using it. No virus found in this incoming message. Checked by AVG. Version: 8.0.101 / Virus Database: 270.4.3/1529 - Release Date: 7/1/2008 7:23 PM
[jQuery] Re: Replicating frame interface with jquery?
Take a look at the Splitter plugin http://methvin.com/jquery/splitter/ On Jul 2, 9:56 am, fambi [EMAIL PROTECTED] wrote: We're looking to replicate the traditional email client interface without using frames, much the same way that Yahoo Mail beta has done. Has anyone written a plugin or tutorial for this? If not, can anyone give me a rough idea of how the resizing part of it all works? Thanks
[jQuery] [autocomplete] changing data when clicking on an entry
thanks for anybody that may help, I have in my DB several results that may have characters like ', , , , etc. I'm normally just converting these to the respect #039; lt; etc when displaying them but I have a small problem using this plugin to do so. If I don't sanitize the output, the dropdown menu shown by the autocomplete plugin gets broken (as the browser is being given bad html) and it leaves my users open to XSS and javascript attacks and whatnought. Now, when I do sanitize the output the dropdown menu itself looks great as it should. But clicking an entry will then make my input box have a value of say -- lt;Testrt; #039;Data#034; which is obviously not quite what I'm going for. Do I need to modify the autocomplete.js to do some string replacement to set these back or.. ? If I set the input field manually as input value='lt;Test ... it appears in the input box as -- Test 'Data -- as it should. many thanks again! Benjamin Owens
[jQuery] How to pull a # URL value into a jquery variable?
Hey People, I am building a FAQ that sits in an accordion structure. Everything is closed when you first open the page, but we want the ability to link directly to a specific question, so if someone inputs www.mydomain.com/faq#question35 into the address bar, jQuery can pull the value of question35 into a variable and then I can reference it in the code and open the corresponding question. I'm sure this is possible, but I'm just a newb, so I need some help. Thanks! -Steve
[jQuery] Using ClueTip with Image Maps in IE
Hello, I've been working with ClueTip (GREAT plug-in!) and image maps. After digging around on Google for some time I came across the link to this example: http://test.learningjquery.com/clue/chic-test.html (note that there are only two images that display the Cluetip and that neither has a title. You will see what appears to be a native tip, but that is coming from the Alt tag on this page). Based on that I was able to get it working on the Image Map, but I do have one problem. The native title attribute displays in IE (it does not in FF). If I remove it from the link, then that gets rid of the native tip, but then I can't use the Title attribute to pass the title for the tooltip to ClueTip and I'd really like to be able to use that feature. Does anyone have an idea on either how to get rid of the native title display in IE, or how to pass a title to ClueTip in some other fashion? I'm really close to getting this working like I want it, but hate to give up the title on the tips. Thanks for any and all assistance and ideas! Chuck
[jQuery] Re: How to display a Dialog Box (with confirmation buttons) when external link is clicked
Hi Michael, did you tried the blockUI plugin? It should fit your requirements. Check it here http://malsup.com/jquery/block/#dialog -- Luca On Jul 1, 6:44 am, Michael Brennan-White [EMAIL PROTECTED] wrote: jQuery Newbie question. I work for a state government and need to display a message letting the user know a link is to an external site. In the past I have obviously used a javascript alert() but would rather use something nicer which could hopefully allow the use of a background image and readable text. I have been playing around with the dialog piece of the jquery ui but find that it is beyond my skill level at this point. If you have some code (or can point me to some code) that would a. Display a dialog box when a link of a certain type was clicked in the center of the browser window. b. Contain confirmation buttons in the dialog. If either buttons were clicked, the dialog box would be hidden or destroyed. c. If the Yes button was clicked I would like to open the link they were clicking on. Thank you very much for reading this message and in advance for your assistance, Michael
[jQuery] How to pull a # URL value into a jquery variable?
Hey People, I am building a FAQ that sits in an accordion structure. Everything is closed when you first open the page, but we want the ability to link directly to a specific question, so if someone inputs www.mydomain.com/faq#question35 into the address bar, jQuery can pull the value of question35 into a variable and then I can reference it in the code and open the corresponding question. I'm sure this is possible, but I'm just a newb, so I need some help. Thanks! -Steve
[jQuery] Re: Moving mouse fast causes mouseout not to fire
Awesome! You're the man, Karl - thanks. FWIW I was able to use your same technique by using .addClass( 'Layer-11-12-wrapper') on both 11 and 12 instead of adding the div to the HTML section and get the same performance. And thank you too for the suggestion on correct use of the images as background vs inline. I didn't have a good feel for correctness on that. The code generator will take a hint from any layer name to make the image a CSS background-image url instead, but it isn't the default. It's interesting though - due to the intended use of the code generator, many times shouldn't the image correctly be inlined? For a graphical element of a menu for example? Certainly for a background to anything - the page, a form, a logo, some other design element - then the CSS background-image url would way to go. Thanks again. -- Shaun
[jQuery] contradictory between jquery and pure javascript
Hi all, my site is jquery based but i used a javascript code in a separate file to create a marquee, my problem now is that they don't work together, if i called only the jquery, it works, and if i called only my own javascript file it works, but calling the both together, only the last one called works, do such a contradictory problems appear frequently, solution please.
[jQuery] Help with livequery logic
I am trying livequery to solve this problem. I have a youth mentoring site that has profiles. They want to filter the profiles. I have a div that I use to stuff the filtered data into (#FilteredProfiles). The filtered data has pagination links at the bottom that I do not have control over. I want to bind a function to those links that does a post and gets new data. The problem is that the new data that is returned has new pagination links that need the function rebound. If I do not rebind the pagination links then the ones that are created by the cms are used and the browser loads the wrong page. I have used livequery in this logic with success so I know it is working. The problem lies in the area marked This is the problem area. When that code executes the post does it's thing but the new links inside the new data do not get the function rebound. If I remove that section of logic then the link that I click on changes text to Clicked! like it is supposed to. Does anybody have any suggestions? Thanks! ** $(document).ready(function(){ getData(); $(#FilterSubmit).livequery('click', function(){ getData(); });//End of the filterSubmit actions });//end of ready function function getData(){ var $pagename=http://www.youthmentoring.net/includes/publicProfiles+$(#gender option:selected).val()+$(#location option:selected).val(); $(#FilteredProfiles).html('img src=http://www.youthmentoring.net/images/text-fetching data.gif alt=Fetching data'); $(#FilteredProfiles).load($pagename, function(data){ $(#FilteredProfiles).html(data); $('#Pagination a').livequery('click', function() { var pattern=/P[0-9]([0-9]*)?/; var $urlAppend; if ($(this).attr(href).match(/P[0-9]([0-9]*)?/)){ $urlAppend = $(this).attr(href).match(/P[0-9]([0-9]*)?/)[0]; }else{ $urlAppend = P0; } //Display getting data graphic //This is the problem area $(#FilteredProfiles).html('img src=http://www.youthmentoring.net/images/text-fetching data.gif alt=Fetching data'); var $url=http://www.youthmentoring.net/includes/publicProfiles+$(#gender option:selected).val()+$(#location option:selected).val()+/+$urlAppend ; $(#FilteredProfiles).post($url, function(data){ $(#FilteredProfiles).html(data); }); //End of the problem area $(this).text('Clicked').blur(); return false; }); });//End of load }//End of getData function **
[jQuery] jQuery mouseover don't work(others do)
Ok, here is my problem i have these to code Snippets. The one on the Bottom works as intended, the top one instead doesn't work. as you'll see, say are nearly the same, except for the id. I don't get the difference, why the one works and the other not Hope somebody can help:) PROBLEM CODE: //--- // the openSubs cell //--- var resultHeaderTableDashOpenSubs = resultHeaderTableRow.insertCell(-1); resultHeaderTableDashOpenSubs.style.width = 6%; resultHeaderTableDashOpenSubs.style.textAlign = center; resultHeaderTableDashOpenSubs.style.verticalAlign = middle; resultHeaderTableDashOpenSubs.id = this.outerTagID + _openSubs; var openSubPic = document.createElement(img); openSubPic.src = _img/action/arrow_right.gif; openSubPic.id = this.outerTagID + _openSubsPic; resultHeaderTableDashOpenSubs.appendChild(openSubPic); var resultObject = this; $(# + resultObject.outerTagID + _openSubs).mouseover(function() { document.body.style.cursor = pointer; }).mouseout(function(){ document.body.style.cursor = auto; }).click(function(){ $(# + resultObject.outerTagID + _subsDiv).slideToggle(200); if ($(# + resultObject.outerTagID + _openSubsPic).attr(src) == _img/action/arrow_right.gif) { $(# + resultObject.outerTagID + _openSubsPic).attr(src, _img/action/arrow_down.gif); } else { $(# + resultObject.outerTagID + _openSubsPic).attr(src, _img/action/arrow_right.gif); } }); WORKING CODE: //--- // the openSnippet cell //--- var resultHeaderTableDashOpenSnippet = resultHeaderTableRow.insertCell(-1); resultHeaderTableDashOpenSnippet.style.width = 6%; resultHeaderTableDashOpenSnippet.style.textAlign = center; resultHeaderTableDashOpenSnippet.id = this.outerTagID + _openSnippet; var openSnippetPic = document.createElement(img); openSnippetPic.src = _img/action/open_symbol.gif; openSnippetPic.id = this.outerTagID + _openSnippetPic; resultHeaderTableDashOpenSnippet.appendChild(openSnippetPic); var resultObject = this; $(# + resultObject.outerTagID + _openSnippet).mouseover(function(){ document.body.style.cursor = pointer; }).mouseout(function(){ document.body.style.cursor = auto; }).click(function(){ $(# + resultObject.outerTagID + _snippetDiv).slideToggle(200); if ($(# + resultObject.outerTagID + _openSnippetPic).attr(src) == _img/action/open_symbol.gif) { $(# + resultObject.outerTagID + _openSnippetPic).attr(src, _img/action/close_symbol.gif); } else { $(# + resultObject.outerTagID + _openSnippetPic).attr(src, _img/action/open_symbol.gif); } });
[jQuery] How to catch function call
Hello, I have one page with one iframe, and there are few javascript function on the page inside the iframe. These functions are triggered by some flash presentations. Basically the parent page has to 'know' when the user has requested the next page (inside the iframe) and update its content with relevant data related with this new page inside the iframe. I can't change the javascript functions from the pages inside the iframe. Thanks Luiz.
[jQuery] Re: Element's inner/children
Sounds like you're really close. How about $(#prev-msgs).append('div id=p' + pCurrent + '' + $(#new-msgs).html() + '/div') - Richard On Wed, Jul 2, 2008 at 11:02 AM, noon [EMAIL PROTECTED] wrote: I have the following HTML structure: div id=new-msgs div class=msg.../div div class=msg.../div /div I have the following code: $('#new-msgs') .appendTo('#prev-msgs') .wrap('div id=p'+pCurrent+'/div'); I want everything inside #new-msgs to be appended to #prev-msgs, and not #new-msgs as well. Using a selector of #new-msgs * loses the hierarchical structure that I want to maintain (div.msg has children). Also using .html() on #new-msgs and then appending +wrapping results in multiple wraps. What's the best way to get the contents of a container and append them somewhere else?
[jQuery] Re: contradictory between jquery and pure javascript
On 3 Lug, 11:11, yazid [EMAIL PROTECTED] wrote: such a contradictory problems appear frequently, solution please. maybe http://docs.jquery.com/Core/jQuery.noConflict :)
[jQuery] Re: jQuery mouseover don't work(others do)
Ok something new, not that somebody thinks I don't work on this:P It doesn't work with FF, but with the IE there are no Problems.
[jQuery] JQuery Cycle Previous / Next Question
I'm using JQuery's Cycle plugin to assemble a slide show and enable next / previous operations. This is all working fine, my question is this ... Is there a way to set the previous and next transition effect differently from the slide shows main transition effect? Currently my slide show slides the images in from the left ( scrollRight ), this works good for the normal function and the 'next' function ... however the 'previous' slide should scroll in from the right ( scrollLeft ) to give the effect that we are actually going back the other way. Anyone know how to do this? Thanks div id=slides img src=img1.jpg / img src=img2.jpg / img src=img3.jpg / /div a id=next href=# next /a a id=prev href=# next /a $('#slides').cycle({ fx: scrollRight', speed: 'fast', timeout: 5000, next: '#next', prev: '#prev' });
[jQuery] javascript analogue of php serialize()
Hello! I need javascript function analogue of php serialize(). So far, use serialize function from: http://javascript.ru/php/serialize , which not work with Internet Explorer, and opera, with Firefox there is no problem. I`m using this function to serialize an array data, or objects.
[jQuery] Re: How to pull a # URL value into a jquery variable?
Javascript has access to the location.hash property: http://www.java2s.com/Tutorial/JavaScript/0320__Location/Locationhash.htm -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of CraniumDesigns Sent: Thursday, July 03, 2008 3:57 AM To: jQuery (English) Subject: [jQuery] How to pull a # URL value into a jquery variable? Hey People, I am building a FAQ that sits in an accordion structure. Everything is closed when you first open the page, but we want the ability to link directly to a specific question, so if someone inputs www.mydomain.com/faq#question35 into the address bar, jQuery can pull the value of question35 into a variable and then I can reference it in the code and open the corresponding question. I'm sure this is possible, but I'm just a newb, so I need some help. Thanks! -Steve
[jQuery] Re: javascript analogue of php serialize()
http://docs.jquery.com/Ajax/serialize On 3 Jul., 14:49, Julian [EMAIL PROTECTED] wrote: Hello! I need javascript function analogue of php serialize(). So far, use serialize function from:http://javascript.ru/php/serialize , which not work with Internet Explorer, and opera, with Firefox there is no problem. I`m using this function to serialize an array data, or objects.
[jQuery] Modifying Plugins
I'd like to modify just 1 function in a ui plugin to add an extra ability it doesn't have but I'd rather not put my code in the ui code file. I've done this in other frameworks and projects by just doing something similar to this: prototype.targetobjt.method = function() {}; I'm sure everyone gets this but I just wanted to make it clear that I do understand how the prototype system works. What I'm not understanding is how $.widget() works and how I can accomplish this in the jquery system.
[jQuery] Re: Proper Memory Cleanup?
I wasn't asking how to clean up I know this already I was asking what to clean up On Jun 21, 5:26 am, Orkan [EMAIL PROTECTED] wrote: it depends of the object (proto) type ;) simple object could be cleaned this way: myObj = null; As far as I know, it is used to avoid memory leaks in certain versions of IE 6, other browsers will do it automatically On Jun 20, 5:31 pm, Scott [EMAIL PROTECTED] wrote: Can someone point me to or give me some advice in what the best coding practices would be for cleaning up after myself while using jquery? Specifically I'm thinking about using the ajax functions like load(), if my loaded page has tabs or something like that in it and I remove that loaded section will I have a bunch of orphaned JS objects sitting around from the tabs? Am I making any sense?
[jQuery] Re: Modifying Plugins
Please ask on the jQuery UI list http://groups.google.com/group/jquery-ui - Richard On Thu, Jul 3, 2008 at 9:54 AM, Scott [EMAIL PROTECTED] wrote: I'd like to modify just 1 function in a ui plugin to add an extra ability it doesn't have but I'd rather not put my code in the ui code file. I've done this in other frameworks and projects by just doing something similar to this: prototype.targetobjt.method = function() {}; I'm sure everyone gets this but I just wanted to make it clear that I do understand how the prototype system works. What I'm not understanding is how $.widget() works and how I can accomplish this in the jquery system.
[jQuery] Re: How to catch function call
Is the iframe loaded from the same domain as the containing page, or a different domain? From: Luiz Abrahao I have one page with one iframe, and there are few javascript function on the page inside the iframe. These functions are triggered by some flash presentations. Basically the parent page has to 'know' when the user has requested the next page (inside the iframe) and update its content with relevant data related with this new page inside the iframe. I can't change the javascript functions from the pages inside the iframe. Thanks Luiz.
[jQuery] Re: is it possible define how much color 32bit or 24bit or 16bit?
You don't need jQuery for this. window.screen has the information you're looking for. -Mike From: mtest jQuery can define browser $(.browser.msie) $(.browser.safari) $(.browser.mozilla) can define version of browser $(.browser.version) But maybe be define resolution and how much color is it?
[jQuery] IE7 doesn't properly download images for jQuery cycle?
Could anyone please take a look at this: http://www.snyvo.com/site/item.html When I open this page with IE7, the window status bar states that not all of images of the cycle are downloaded. Even if I wait a little longer, the images don't seem to load properly - according to the status bar, that is. The message doesn't disappear until all images in the cycle have been clicked on. Everything seems to work fine in Firefox. Anyone got a clue?
[jQuery] Re: Passing a variable into the $('selector') function
msg was actually myDiv and in the end i got it to work with.. $('#'+msg) Thanks very much for your helpful reply. Cheers On Jul 2, 11:16 pm, Erik Beeson [EMAIL PROTECTED] wrote: If msg is '#myDiv' and you have element with id=myDiv, then $(msg) will select it. If you think that's what you're doing and it isn't working for you, either your id is wrong or msg doesn't hold what you think (maybe it has a trailing \n?). --Erik On 7/2/08, Stompfrog [EMAIL PROTECTED] wrote: Hi all, I have a problem that I can't crack. I have a function similar to this.. $.ajax({ type: POST, url: some.php, data: name=Johnlocation=Boston, success: function(msg){ alert( Data Saved: + msg ); } }); The data that gets passed back to the function from some.php is a string which is the id of the div that I want to manipulate in the callback function e.g. #myDiv. My question is how can I get that div from the callback function using the msg variable because $(msg); doesn't work and neither does $ ('+msg+'); Thanks in advance, Stompfrog
[jQuery] $(#dsp1).load(url) not working in IE7?
I am testing jQuery. This simple code does not work in IE. This image link in the returned html segment is not shown in IE. Just a blank. This is the code: $(#dsp1).load(abc.html); where abc.html has this contents: a href=*img src=reddot.gif border=0 alt= bbb title=a br some text IE only shows some text. Firefox shows everything correctly. (some text and an image that can be clicked on). Thanks. Bruce
[jQuery] Removing the html jQuery adds in effects
I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] strange problem with cluetip
I am using cluetip on a section of my left menu. Each ajax call returns a small amount of text and possibly a picture. Sometimes it's the wrong picture. Is it possible that if someone moves the mouse over several menu items rather quickly such that several ajax calls are made in quick succession that the text for the second call gets matched with the picture from the first call? Looking at my log file, the sequence of entries supports this thesis. If that is the case, how can I prevent it? The website is http://lpnc.org and the menu section is the listing of candidates. -- I am only one. But I am one. I cannot do everything but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward E. Hule Rick Pasotto[EMAIL PROTECTED]http://www.niof.net
[jQuery] Re: Noob question about accessing element contents
This forum is about using jQuery, thus I assumed that I didn't have to spell out that I indeed of course meant the best jquery way. Thank you for your answer.
[jQuery] jQuery not setting X-Requested-With XMLHttpRequest
I'm using jQuery 1.2.6, and I can't seem to get jQuery to set the X- Requested-With when it makes AJAX calls. I saw somewhere that this may have to do with cross-site issues if the host is specified in the URL. I've tried skirting around that by just passing a relative URL, but with no success. I'm wondering what I might be doing wrong, or if someone can point me in the right direction. Here's what my jQuery code looks like: $.ajax({ type: POST, url: '/votes/43', dataType: html, data: method=delete, success: function(data) { $(this).parents('div.vote_box').after(data).remove(); } }); I've tried it also by adding a beforeSend, of: beforeSend: function(xhr) { xhr.setRequestHeader(X-Requested-With, XMLHttpRequest); }, I've inspected the request headers with Firebug and with a separate HTTP tracing tool, and the X-Requested-With header is never present. The host, when I'm debugging like this is http://localhost:3000;, or I've also tried with http://localhost; (i.e. just running on 80). I've tried this in both Firefox 3 and Safari.
[jQuery] Re: Position cursor at end of textbox?
$.extend($.fn, { selectRange: function(start, end) { // use only the first one since only one input can be focused if ($(this).get(0).createTextRange) { var range = $(this).get(0).createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', start); range.select(); } else if ($(this).get(0).setSelectionRange) { $(this).focus().get(0).setSelectionRange(start, end); } return $(this); } }); I think it's pretty much the best crossbrowser solution you will find. $('input').selectRange(0,0) to reset the carret position, to position it at the end you will need to get length of the input's value.. you just made me think I could add support for -1, thanks :D ~h On Jul 2, 2:55 pm, Paul Malan [EMAIL PROTECTED] wrote: By default it seems browsers select all the text in a textbox when it gains focus by way of a tab-press. I would like the cursor to be positioned at the end of any existing text in the input, instead. The examples I'm turning up on Google don't work and seem needlessly complex, and since jQuery simplifies everything else I used to hate about Javascript, I thought I'd see if there's a simple way to position the cursor in a text input box on focus. Is it doable? Thanks...
[jQuery] Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
The (rather long) subject line says it all. This idiom is widely used to avoid having to assume $ == jQuery and at the same time avoiding writing jQuery all the time. (function($){ ... })(jQuery) I'm wondering if instead this would work. (function(){ var $ = jQuery; ... })() The reason I ask is that I'd like to shorthand several things in this way. The first method requires me to go down to the end of a (long) function body to find out what, say '_' and 'C' really mean (private and Constants, say), whereas the second method tells me up front. I know enough JavaScript to think of this alternative approach, but not enough to be sure that it will work in all relevant circumstances. -- Jonathan
[jQuery] Re: JQuery Cycle Previous / Next Question
You're looking for the fx: scrollHorz It's hidden in the list of effects: http://malsup.com/jquery/cycle/begin.html On Jul 3, 8:31 am, Ara [EMAIL PROTECTED] wrote: I'm using JQuery's Cycle plugin to assemble a slide show and enable next / previous operations. This is all working fine, my question is this ... Is there a way to set the previous and next transition effect differently from the slide shows main transition effect? Currently my slide show slides the images in from the left ( scrollRight ), this works good for the normal function and the 'next' function ... however the 'previous' slide should scroll in from the right ( scrollLeft ) to give the effect that we are actually going back the other way. Anyone know how to do this? Thanks div id=slides img src=img1.jpg / img src=img2.jpg / img src=img3.jpg / /div a id=next href=# next /a a id=prev href=# next /a $('#slides').cycle({ fx: scrollRight', speed: 'fast', timeout: 5000, next: '#next', prev: '#prev' });
[jQuery] I need
I need a component/widget that works as follows: 1. Collapsible/Expandable 2. When Expanded a tabbed list appears. 3. Upon mouse entry into the tab list the div content is revealed. 4. Upon mouse leave from the tab list the div content disappears. 5. Div content is a list of forms that open in a lightbox Any ideas? mootools has a mouse entry demo and jquery has all other pieces; but when I mash it up, I get no love. is their a event chain UI that I can custom style easily. I saw the theme roller jquery ui...is this the solution? I need some hand holding.
[jQuery] DELETE HTTP method
Can somebody show example how to send via AJAX DELETE HTTP method instead of POST, like this: $.post( '/filial/del/', {city:$.trim(city)} ); but DELETE. I tried: $.ajax( {url:'/filial/del/', type:'DELETE', data:'city='+encodeURI($.trim(city))} ); and: $.ajax( {url:'/filial/del/', dataType:'json', type:'DELETE', data: {'city':$.trim(city)}} ); but in django vie see that no any 'city' in POST or GET! Is this possible? I don't see any DELETE in jQuery source...
[jQuery] Re: JQuery Cycle Previous / Next Question
See this page: http://www.malsup.com/jquery/cycle/scrollhv.html On Jul 3, 8:31 am, Ara [EMAIL PROTECTED] wrote: I'm using JQuery's Cycle plugin to assemble a slide show and enable next / previous operations. This is all working fine, my question is this ... Is there a way to set the previous and next transition effect differently from the slide shows main transition effect? Currently my slide show slides the images in from the left ( scrollRight ), this works good for the normal function and the 'next' function ... however the 'previous' slide should scroll in from the right ( scrollLeft ) to give the effect that we are actually going back the other way. Anyone know how to do this? Thanks div id=slides img src=img1.jpg / img src=img2.jpg / img src=img3.jpg / /div a id=next href=# next /a a id=prev href=# next /a $('#slides').cycle({ fx: scrollRight', speed: 'fast', timeout: 5000, next: '#next', prev: '#prev' });
[jQuery] Re: IE7 doesn't properly download images for jQuery cycle?
Works fine for me in IE7. On Jul 3, 12:04 pm, snyvo [EMAIL PROTECTED] wrote: Could anyone please take a look at this:http://www.snyvo.com/site/item.html When I open this page with IE7, the window status bar states that not all of images of the cycle are downloaded. Even if I wait a little longer, the images don't seem to load properly - according to the status bar, that is. The message doesn't disappear until all images in the cycle have been clicked on. Everything seems to work fine in Firefox. Anyone got a clue?
[jQuery] Re: strange problem with cluetip
On Thu, Jul 03, 2008 at 11:42:02AM -0400, Rick Pasotto wrote: I am using cluetip on a section of my left menu. Each ajax call returns a small amount of text and possibly a picture. Sometimes it's the wrong picture. Is it possible that if someone moves the mouse over several menu items rather quickly such that several ajax calls are made in quick succession that the text for the second call gets matched with the picture from the first call? Looking at my log file, the sequence of entries supports this thesis. If that is the case, how can I prevent it? The website is http://lpnc.org and the menu section is the listing of candidates. I think I've solved it. I hadn't included jquery.hoverIntent.js -- Speak softly, gently and sweetly; you might end up eating your words. -- Unknown Rick Pasotto[EMAIL PROTECTED]http://www.niof.net
[jQuery] Re: Cycle / carousel with partial images on either side?
Wondering if there's an easy way to do this, either with the Cycle plugin by Mike Alsup or a similar plugin. We have a set of images scrolling left to right, but is it possible to show a little bit of the images on either side as well? ie. div| A | | ALL OF B | | C |/div So in the above example, the right edge of image A and left edge of image C can be seen either side of image B. Then the scroll happens: div| B | | ALL OF C | | D |/div C is now visible with B's right edge on and D's left edge on either side. Hope I've explained this adequately - all help would be greatly appreciated. :) Regards, Michael Price Cycle won't handle that out of the box; you'd have to write a custom transition. This page shows you how you can define your own transitions: http://www.malsup.com/jquery/cycle/adv2.html
[jQuery] Re: DELETE HTTP method
From http://docs.jquery.com/Ajax/jQuery.ajax#options The type of request to make (POST or GET), default is GET. Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. - Richard On Thu, Jul 3, 2008 at 11:23 AM, Yosifov Pavel [EMAIL PROTECTED] wrote: Can somebody show example how to send via AJAX DELETE HTTP method instead of POST, like this: $.post( '/filial/del/', {city:$.trim(city)} ); but DELETE. I tried: $.ajax( {url:'/filial/del/', type:'DELETE', data:'city='+encodeURI($.trim(city))} ); and: $.ajax( {url:'/filial/del/', dataType:'json', type:'DELETE', data: {'city':$.trim(city)}} ); but in django vie see that no any 'city' in POST or GET! Is this possible? I don't see any DELETE in jQuery source...
[jQuery] New plugin: jquery.onfontresize.js
I've just released a new plugin that exposes an onfontresize event on the document object. It's based heavily on a technique created (AFAIK) by Hedger Wang which you can read about here: http://www.hedgerwow.com/360/dhtml/js-onfontresize.html I made some minor tweaks and packaged it up as a simple to use jquery plugin which you can find here: http://tomdeater.com/jquery/onfontresize/
[jQuery] Re: IE7 doesn't properly download images for jQuery cycle?
Really? IE7 on PC? Thanks for checking Mike. Anyone else that sees the problem?
[jQuery] Re: Using ClueTip with Image Maps in IE
Hi there, Sorry for the delay in replying. I'll try to take a look at this tonight. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 3, 2008, at 5:27 AM, C.Everson wrote: Hello, I've been working with ClueTip (GREAT plug-in!) and image maps. After digging around on Google for some time I came across the link to this example: http://test.learningjquery.com/clue/chic-test.html (note that there are only two images that display the Cluetip and that neither has a title. You will see what appears to be a native tip, but that is coming from the Alt tag on this page). Based on that I was able to get it working on the Image Map, but I do have one problem. The native title attribute displays in IE (it does not in FF). If I remove it from the link, then that gets rid of the native tip, but then I can't use the Title attribute to pass the title for the tooltip to ClueTip and I'd really like to be able to use that feature. Does anyone have an idea on either how to get rid of the native title display in IE, or how to pass a title to ClueTip in some other fashion? I'm really close to getting this working like I want it, but hate to give up the title on the tips. Thanks for any and all assistance and ideas! Chuck
[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6
Hi Jeffrey, It might be worth starting a new thread on the jquery-dev list for this, since it does have to do with examining the core file. Would you mind doing that? thanks! --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 3, 2008, at 12:36 PM, Jeffrey Kretz wrote: I'm using Firefox 2 still. Firebug is exception in all areas except for the javascript debugger. But it did allow me to set breakpoints and step into (F11) the code and inspect the variables to see what was happening. Oddly enough the grep method did not change at all between 1.2.3 and 1.2.6. I think we need someone who's more familiar with the core to check this out. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 9:57 PM To: jQuery (English) Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6 Hi Jeff thanks a lot for taking a look at my problem. I edited the jquery-1.2.6 file and added {} codeblocks to the problem area you described, and still the same error. Strange that the error is so deep in the jquery library. did you use firebug to find that bug? I'm finding firebug to be somewhat of a pain for javascript debugging, especially the beta with firefox 3. Are there any other good js debuggers out there? If anybody else has any suggestions for me, i would really appreciate it. thanks On Jul 2, 6:33 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: As a note, your apparatusTooltips.js script has a badly-formed array on lines 30-37. This doesn't affect FF but will kill IE. But onto the underlying problem. The actual issue seems to be with the grep method: // Go through the array, only saving the items 1197 // that pass the validator function 1198 for ( var i = 0, length = elems.length; i length; i++ ) 1199if ( !inv != !callback( elems[ i ], i ) ) 1200 ret.push( elems[ i ] ); When show is called, it first filters by ':hidden'. There is only 1 element in the elems array. The loop starts off correctly, going through 1198, 1199, 1200 for the first iteration. The second iteration it exist the for loop as (ilength) returns false. But when exiting the loop, it still executes line 1200, adding a null value to the return array. This is likely a bug in FireFox, but it would probably go away if code blocks { } were expressly defined around the for loop and the if statement. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery- [EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 4:42 PM To: jQuery (English) Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6 right. ok well this doesn't look like just an each() error, its happening with click() now too. here is the page with the errors:http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1 generate the errors by clicking on show or [+] in the Commentary menu to the lower left of the page. The former generates a object not defined error the latter generates a this.style not defined Again, this code works correctly with 1.2.3. A suggestion on the irc channel was to first check if the thing being passed into .each() is not undefined, but I don't really understand this suggestion. thanks for any help. On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: That part of the code is the $.each iteration. What is the call stack when the error is thrown? Without a better context, it's going to be really hard to see what's going on. Do you have a demo page with this error? Even if you can't post the full page for security reasons, if you can reproduce the error with a simpler demo page that would help track it down. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery- [EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 3:00 PM To: jQuery (English) Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6 Hi I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but doing so is causing a error in my script Firebug gives the error: object is undefined var name, i = 0, length = object.length;http://../script/jquery-1.2.6.js Line 725 I'm going to try to step through my code and narrow down the problem, but i'd appreciate any other suggestions. thanks
[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6
Certainly. Darren, could you put up two pages, one using 1.2.3 and the other using 1.2.6 so the dev team has something to look at? I see that the url in the email below has been reverted to 1.2.3 and works now. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Thursday, July 03, 2008 11:24 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6 Hi Jeffrey, It might be worth starting a new thread on the jquery-dev list for this, since it does have to do with examining the core file. Would you mind doing that? thanks! --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 3, 2008, at 12:36 PM, Jeffrey Kretz wrote: I'm using Firefox 2 still. Firebug is exception in all areas except for the javascript debugger. But it did allow me to set breakpoints and step into (F11) the code and inspect the variables to see what was happening. Oddly enough the grep method did not change at all between 1.2.3 and 1.2.6. I think we need someone who's more familiar with the core to check this out. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 9:57 PM To: jQuery (English) Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6 Hi Jeff thanks a lot for taking a look at my problem. I edited the jquery-1.2.6 file and added {} codeblocks to the problem area you described, and still the same error. Strange that the error is so deep in the jquery library. did you use firebug to find that bug? I'm finding firebug to be somewhat of a pain for javascript debugging, especially the beta with firefox 3. Are there any other good js debuggers out there? If anybody else has any suggestions for me, i would really appreciate it. thanks On Jul 2, 6:33 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: As a note, your apparatusTooltips.js script has a badly-formed array on lines 30-37. This doesn't affect FF but will kill IE. But onto the underlying problem. The actual issue seems to be with the grep method: // Go through the array, only saving the items 1197 // that pass the validator function 1198 for ( var i = 0, length = elems.length; i length; i++ ) 1199if ( !inv != !callback( elems[ i ], i ) ) 1200 ret.push( elems[ i ] ); When show is called, it first filters by ':hidden'. There is only 1 element in the elems array. The loop starts off correctly, going through 1198, 1199, 1200 for the first iteration. The second iteration it exist the for loop as (ilength) returns false. But when exiting the loop, it still executes line 1200, adding a null value to the return array. This is likely a bug in FireFox, but it would probably go away if code blocks { } were expressly defined around the for loop and the if statement. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery- [EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 4:42 PM To: jQuery (English) Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6 right. ok well this doesn't look like just an each() error, its happening with click() now too. here is the page with the errors:http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1 generate the errors by clicking on show or [+] in the Commentary menu to the lower left of the page. The former generates a object not defined error the latter generates a this.style not defined Again, this code works correctly with 1.2.3. A suggestion on the irc channel was to first check if the thing being passed into .each() is not undefined, but I don't really understand this suggestion. thanks for any help. On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: That part of the code is the $.each iteration. What is the call stack when the error is thrown? Without a better context, it's going to be really hard to see what's going on. Do you have a demo page with this error? Even if you can't post the full page for security reasons, if you can reproduce the error with a simpler demo page that would help track it down. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery- [EMAIL PROTECTED] On Behalf Of darren Sent: Wednesday, July 02, 2008 3:00 PM To: jQuery (English) Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6 Hi I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but doing so is causing a error in my script Firebug gives the error: object is undefined var name, i = 0, length = object.length;http://../script/jquery-1.2.6.js Line 725 I'm going to try to step through my code and narrow down the problem, but i'd appreciate any other suggestions. thanks
[jQuery] offSetTop offsetLeft return NULL
I have these functions: var e_w = jQuery(a).eq(index).width(); var e_h = jQuery(a).eq(index).height(); var e_ox = jQuery(a).eq(index).offsetLeft; var e_oy = jQuery(a).eq(index).offsetTop; the first 2 return numbers such as 50 and 100. But the last 2 each return NULL. Why are they returning NULL? How can I get the offset of an element given it's index in terms of a tags?
[jQuery] Re: Using ClueTip with Image Maps in IE
On Thu, 3 Jul 2008 14:12:56 -0400, Karl Swedberg wrote: Sorry for the delay in replying. I'll try to take a look at this tonight. Thanks Karl! BTW, another issue that I ran into with the Image Maps is that REL appears to NOT be a valid attribute of the AREA tag. This was causing HTML validation to croakg. I was able to reset ClueTip to use the href to pass the ID of a hidden content div down the page, but that seems a bit of a kludge... Thinking about that (and digging into your code some more) I found that the first parameter to ClueTip can be the tip. That made me wonder if (for Image Maps) it might be better to be able to set splitTitle: true and then pass both the tip and title as the first parameter (with the | or whatever as the split element. Of course that would not make the map 508 friendly (since there would be no Alt or Title over the AREA), but it might be a way to make things work and still pass validation. If that was an option, then I guess the only other consideration would be how to solve the REL issue (and still pass validation). Another idea (if possible), might be to use splitTitle and get it to pull the tip title from the first part of the content pulled in for the tip... Anyway - thanks again for your great work on this and I look forward to seeing what you come up with. Chuck
[jQuery] Re: IE7 doesn't properly download images for jQuery cycle?
I use iQuery to ajax this abc.html: a href=*img src=reddot.gif border=0 alt=bbb b title=a My text Only My text is loaded in to IE 7. FF loads the image so you can see it. This is my ajax code: $(#dsp1).load(abc.html); Why IE can not do this simple thing?
[jQuery] Re: Removing the html jQuery adds in effects
This is what you would want to do: $(#gallery li:first).before(litesting/ li).hide().slideDown(slow) On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote: I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] disable buttons till .load finishes
I'm looking for a way to be able to disable a button generated with the dialog extension of jquery ui until the .load function finishes filling the dialog with an ajax request. When I put in display:none/ display:block for the parent element... after the .load... it still hasn't loaded while the buttons have appeared. No good! How can I keep folks from pushing these buttons until after the information loads? ~Andrew Gearhart
[jQuery] Re: javascript analogue of php serialize()
http://docs.jquery.com/Ajax/serialize Serializes a set of input elements into a string of data. That did not work for me. Like i said a have the data in array, and just want to serialize that data, not data from input elements. Greetings!
[jQuery] Re: Navigate away after ajax call?
It works because it's asynchronous. The $.get call is fired, and then the script continues along its merry way, without waiting for the return of the $.get call. -- Josh - Original Message - From: wsw [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, July 03, 2008 11:16 AM Subject: [jQuery] Navigate away after ajax call? My code: ---in the script--- $('a').click(function() { $.get('/long_running_page'); return true; } ---on the page--- a href=http://www.otherserver.com;click here/a. This appears to work. The long running page finishes (writes a file on the server) even though I've navigated to otherserver.com by the time it's done. Is this documented behavior or am I getting lucky? Thanks!
[jQuery] Re: Removing the html jQuery adds in effects
First of all, thank you very much for the reply. It is really hard to get any reply in this mailing list. This is the third time I'm asking something and you are the first to answer. Unfortunately, I've tried this and it kinda acts weird. Instead of wrapping the litesting/li with the effect, it wraps the next element, so now the second does the slideDown effect. You can see this here: http://treazy.com/pek/album/ Just click previous and watch what happens. Do you know how to work around this? Thanks again. On Jul 3, 10:30 pm, real [EMAIL PROTECTED] wrote: This is what you would want to do: $(#gallery li:first).before(litesting/ li).hide().slideDown(slow) On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote: I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] Re: disable buttons till .load finishes
Please ask on the jQuery UI list: http://groups.google.com/group/jquery-ui Thanks. - Richard On Thu, Jul 3, 2008 at 3:33 PM, Andrew Gearhart [EMAIL PROTECTED] wrote: I'm looking for a way to be able to disable a button generated with the dialog extension of jquery ui until the .load function finishes filling the dialog with an ajax request. When I put in display:none/ display:block for the parent element... after the .load... it still hasn't loaded while the buttons have appeared. No good! How can I keep folks from pushing these buttons until after the information loads? ~Andrew Gearhart
[jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
Hi Jonathan, I think they would both qork exactly the same, BUT this notation... (function($){ ... })(jQuery) Is usually used in plugin authoring to isolate the $ variable in case the user has decided to use jQuery.noConflict(); - which disables access to jQuery via $. So this code is for your personal use (ie.: you're not going to share it with anyone) and you're not using jQuery.noConflict();, then you don't need to declare the $ variable at all. Hope this helps. Diego 2008/7/3 jfine [EMAIL PROTECTED]: The (rather long) subject line says it all. This idiom is widely used to avoid having to assume $ == jQuery and at the same time avoiding writing jQuery all the time. (function($){ ... })(jQuery) I'm wondering if instead this would work. (function(){ var $ = jQuery; ... })() The reason I ask is that I'd like to shorthand several things in this way. The first method requires me to go down to the end of a (long) function body to find out what, say '_' and 'C' really mean (private and Constants, say), whereas the second method tells me up front. I know enough JavaScript to think of this alternative approach, but not enough to be sure that it will work in all relevant circumstances. -- Jonathan -- Cheers, Diego A.
[jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
Yes, either one will do exactly the same thing. It's purely a matter of taste. You're missing a semicolon at the end of both versions, though. Watch out for that - it can cause you some grief. -Mike From: jfine The (rather long) subject line says it all. This idiom is widely used to avoid having to assume $ == jQuery and at the same time avoiding writing jQuery all the time. (function($){ ... })(jQuery) I'm wondering if instead this would work. (function(){ var $ = jQuery; ... })() The reason I ask is that I'd like to shorthand several things in this way. The first method requires me to go down to the end of a (long) function body to find out what, say '_' and 'C' really mean (private and Constants, say), whereas the second method tells me up front. I know enough JavaScript to think of this alternative approach, but not enough to be sure that it will work in all relevant circumstances.
[jQuery] Re: offSetTop offsetLeft return NULL
offsetLeft and offsetTop are properties of a DOM element, not a jQuery object. A jQuery object does have an offset() method which returns an object containing left and top properties, e.g. var offset = jQuery(a).eq(index).offset(); var e_ox = offset.left; var e_oy = offset.top; Note that these are relative to the *viewport* - not the same values you'd get from the offsetLeft and offsetTop properties. If you want those, you can can get them directly from the DOM element: var element = jQuery(a)[index]; var e_ox = element.offsetLeft; var e_oy = element.offsetTop; -Mike I have these functions: var e_w = jQuery(a).eq(index).width(); var e_h = jQuery(a).eq(index).height(); var e_ox = jQuery(a).eq(index).offsetLeft; var e_oy = jQuery(a).eq(index).offsetTop; the first 2 return numbers such as 50 and 100. But the last 2 each return NULL. Why are they returning NULL? How can I get the offset of an element given it's index in terms of a tags?
[jQuery] Re: Removing the html jQuery adds in effects
pek, Try this (untested): $(litesting/li).hide().insertBefore(#gallery li:first).slideDown(slow); Carl pek wrote: First of all, thank you very much for the reply. It is really hard to get any reply in this mailing list. This is the third time I'm asking something and you are the first to answer. Unfortunately, I've tried this and it kinda acts weird. Instead of wrapping the litesting/li with the effect, it wraps the next element, so now the second does the slideDown effect. You can see this here: http://treazy.com/pek/album/ Just click previous and watch what happens. Do you know how to work around this? Thanks again. On Jul 3, 10:30 pm, real [EMAIL PROTECTED] wrote: This is what you would want to do: $(#gallery li:first).before(litesting/ li).hide().slideDown(slow) On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote: I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] Re: offSetTop offsetLeft return NULL
Dan, Try: var e_ox = jQuery(a).eq(index).offset().left; var e_oy = jQuery(a).eq(index).offset().top; HTH, Carl On Jul 3, 11:49 am, Dan [EMAIL PROTECTED] wrote: I have these functions: var e_w = jQuery(a).eq(index).width(); var e_h = jQuery(a).eq(index).height(); var e_ox = jQuery(a).eq(index).offsetLeft; var e_oy = jQuery(a).eq(index).offsetTop; the first 2 return numbers such as 50 and 100. But the last 2 each return NULL. Why are they returning NULL? How can I get the offset of an element given it's index in terms of a tags?
[jQuery] Re: JQuery 1.2.6 and JQuery Form Plugin in IE7
Cute answer Mike. I use method as a hidden form name all the time and my code is already wrapped with that code everywhere. I'm terrible with coming up with good names for things, but I have to have some name that makes sense. What do you use? I have two key inputs that tell my processing pages what to do with the data coming in - task and method. I get this same error with jquery 1.2.6. in IE only. If I downgrade to jquery 1.2.4, it's fine. This is the error I get (you know how non-helpful JS errors in IE are): Line: 2 Char: 2490 Error: Object doesn't support this property or method Code: 0 URL: myurl here (internal site) On Jul 3, 5:16 am, Mike Alsup [EMAIL PROTECTED] wrote: I think if you avoid using poorly named form inputs, like 'action' and 'method', then you'll be fine. I'll look into why those are causing a problem in 1.2.6. Mike On Jul 3, 2:34 am, Drager [EMAIL PROTECTED] wrote: I haven't a public link to post, but I'm trying with the sample i was found here:http://www.malsup.com/jquery/form/file/ The only diference is jquery version. The error reporting in IE7 is this: Line: 24 Character: 531 Code: 0 Error Message: El objeto no acepta esta propiedad o método On 2 jul, 17:27, Mike Alsup [EMAIL PROTECTED] wrote: On Jul 2, 8:50 am, Drager [EMAIL PROTECTED] wrote: I want to upload a file using JQuery Form Plugin but I have some troubles. It work ok with JQuery 1.2.3 but don't with version 1.2.6 and IE 7. In Firefox2 it works great with both versions of JQuery. * jQuery Form Plugin * version: 2.12 (06/07/2008) * @requires jQuery v1.2.2 or later You need to provide more details than that. What isn't working? Is there an error? Can you post a link?
[jQuery] Validation and Tabs plugins compatibility
Hello all, I am just switching to JQuery from prototype and am trying to use the Validation and Tabs plugins for JQuery. Here's my problem: I have one form tag in which I have my tabs container. Using a dynamic language I am creating multiple tabs for user chosen data, say states. So if the user has chosen 5 states, there are five tabs with the same form fields with the _statename appended to the end of the field name. So, if the user enters data, validates the form and click on continue nothing happens as the user has not touched the other tabs. But, the user doesn't know about this and it is a confusion. Is there a way to select the right tab depending on which tab the validator throws an error in? Any help would be greatly appreciated. I am using the following code: script type=text/javascript $(function() { $('##tabs_container ul').tabs({ fx: { opacity: 'toggle' } }); }); /script script type=text/javascript $().ready(function() { $(##general).validate({ rules: { cfloop list=#stateslist# index=sta cfset sta = ReplaceNoCase(sta,' ','','All') products_#sta#: required osda_#sta#: required, /cfloop }, messages: { cfloop list=#stateslist# index=sta cfset sta = ReplaceNoCase(sta,' ','','All') products_#sta#: Choose product; osda_#sta#: Please choose YES OR NO. /cfloop } }); }); /script Thanks -P
[jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
On 3 Jul, 21:35, Michael Geary [EMAIL PROTECTED] wrote: Yes, either one will do exactly the same thing. It's purely a matter of taste. Thank you both for this. I think Michael right, but perhaps Diego would like to response - he thinks there is a difference. Thank you also Michael for the semicolon warning. I'm now using js2- mode.el with Emacs. It warns me about such errors. -- Jonathan
[jQuery] Re: jQuery not setting X-Requested-With XMLHttpRequest
Does setting the contentType work? http://docs.jquery.com/Ajax/jQuery.ajax#options Chris Bailey-4 wrote: I'm using jQuery 1.2.6, and I can't seem to get jQuery to set the X- Requested-With when it makes AJAX calls. I saw somewhere that this may have to do with cross-site issues if the host is specified in the URL. I've tried skirting around that by just passing a relative URL, but with no success. I'm wondering what I might be doing wrong, or if someone can point me in the right direction. Here's what my jQuery code looks like: $.ajax({ type: POST, url: '/votes/43', dataType: html, data: method=delete, success: function(data) { $(this).parents('div.vote_box').after(data).remove(); } }); I've tried it also by adding a beforeSend, of: beforeSend: function(xhr) { xhr.setRequestHeader(X-Requested-With, XMLHttpRequest); }, I've inspected the request headers with Firebug and with a separate HTTP tracing tool, and the X-Requested-With header is never present. The host, when I'm debugging like this is http://localhost:3000;, or I've also tried with http://localhost; (i.e. just running on 80). I've tried this in both Firefox 3 and Safari. -- View this message in context: http://www.nabble.com/jQuery-not-setting-X-Requested-With-XMLHttpRequest-tp18264663s27240p18268977.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Navigate away after ajax call?
If you aren't sure perhaps you can return true in the $.get callback somehow? wswilson wrote: My code: ---in the script--- $('a').click(function() { $.get('/long_running_page'); return true; } ---on the page--- http://www.otherserver.com click here/a. This appears to work. The long running page finishes (writes a file on the server) even though I've navigated to otherserver.com by the time it's done. Is this documented behavior or am I getting lucky? Thanks! -- View this message in context: http://www.nabble.com/Navigate-away-after-ajax-call--tp18266734s27240p18269027.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] how to load and change the external HTML fragment with AJAX
Hi, I want to load a fragment of external html document (external.html#embeddedContent) with the help of AJAX call, embed (inject) this into my HTML document (main.html#placeToInject), and change this embedded fragment a little. I think that I need load this external fragment and either 1) change this before injection, or 2) inject and change at once before user will notice anything. The both possibilities are ok for me now, but I have a problem with manipulating and filtering the embedded fragment while working with jquery 1.2.1. If I follow the second (2) way, I need to do any manipulation only when content has been already injected into the code. But the following code doesn’t work. Means $(“..”) below relates to original fragment in main.html that has been presented there before injection. See comments in the code. $(document).ready(function(){ // load and inject content var content = main.html; $(#placeToInject).load(content + #embeddedContent *); // change the loaded fragment // here $(“..”) relates to original fragment in main.html (before injection). $(#placeToInject .price).addClass(bold); }); If I follow the first (1) way, I need to have the access to just loaded document (DOM). So I need to attach these manipulation actions to the event that show that the ajax call has been successfully completed. I have tried to do the POST instead GET (since I don’t know how to use the load function with GET and attached function). But I can’t filtering the classes (element with given class) in the fragment. See the comment in the code. $(document).ready(function(){ // load content var embeded = embedded.html; $(#placeToInject).load(embeded + #embeddedContent *, null,function(){ // it doesn’t want to match the classes (means elements with class=”price”) that are located into the loaded fragment $(this).filter(.price).addClass(bold); }); }); I think that it possible to try function .ajaxSuccess( function(evt, request, settings){ alert($(this).filter(#left-side).html()); }); But I don’t know how to prepare the rest of the parameters for my needs, right now. Please provide me feedback, if I properly use the functions above and how may I fix that problems. Thanks
[jQuery] Re: Removing the html jQuery adds in effects
Thank you all for your replies. Carl, I tried yours but nothing happens when clicking previous. Anyway, thanks to a friend of mine, here is the correct code (or at least, the code that works) in case anybody wonders: $(.gallery).prepend(lipek/ li).children(li:first).hide().slideDown(slow); Don't ask me how or why, it just works! ;) I'm trying to figure it out right now. ;) Once again, thank you for your feedback. Panagiotis On Jul 3, 11:08 pm, Carl Von Stetten [EMAIL PROTECTED] wrote: pek, Try this (untested): $(litesting/li).hide().insertBefore(#gallery li:first).slideDown(slow); Carl pek wrote: First of all, thank you very much for the reply. It is really hard to get any reply in this mailing list. This is the third time I'm asking something and you are the first to answer. Unfortunately, I've tried this and it kinda acts weird. Instead of wrapping the litesting/li with the effect, it wraps the next element, so now the second does the slideDown effect. You can see this here: http://treazy.com/pek/album/ Just click previous and watch what happens. Do you know how to work around this? Thanks again. On Jul 3, 10:30 pm, real [EMAIL PROTECTED] wrote: This is what you would want to do: $(#gallery li:first).before(litesting/ li).hide().slideDown(slow) On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote: I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6
Just a note on this - it's a conflict between jQuery 1.2.6 (and NOT 1.2.3) vs. Prototype 1.5.1 and related code. I reduced it to a simple test case - will post something on the dev list in a bit...
[jQuery] Re: Position cursor at end of textbox?
There's a $.caret()? On Jul 2, 8:23 pm, spicyj [EMAIL PROTECTED] wrote: This might be helpful: http://pastie.org/226790// shamelessly stolen from the Masked Input plugin $(:text).bind(focus, function() { $(this).caret(this.value.length); }); Not tested, so I don't know if it works, but it might.
[jQuery] Re: Position cursor at end of textbox?
Bah! What's with the $(this).get(0) when all you need is the this keyword from JavaScript? Oh, and by the way, Your solution would disable selection entirely. I don't think Paul had in mind to kill a flea with a sledgehammer! On Jul 3, 10:58 am, h3 [EMAIL PROTECTED] wrote: $.extend($.fn, { selectRange: function(start, end) { // use only the first one since only one input can be focused if ($(this).get(0).createTextRange) { var range = $(this).get(0).createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', start); range.select(); } else if ($(this).get(0).setSelectionRange) { $(this).focus().get(0).setSelectionRange(start, end); } return $(this); } }); I think it's pretty much the best crossbrowser solution you will find. $('input').selectRange(0,0) to reset the carret position, to position it at the end you will need to get length of the input's value.. you just made me think I could add support for -1, thanks :D ~h On Jul 2, 2:55 pm, Paul Malan [EMAIL PROTECTED] wrote: By default it seems browsers select all the text in a textbox when it gains focus by way of a tab-press. I would like the cursor to be positioned at the end of any existing text in the input, instead. The examples I'm turning up on Google don't work and seem needlessly complex, and since jQuery simplifies everything else I used to hate about Javascript, I thought I'd see if there's a simple way to position the cursor in a text input box on focus. Is it doable? Thanks...
[jQuery] Re: Position cursor at end of textbox?
Returns error: $(this).caret is not a function. The function must be part of the plugin you alluded to. On Jul 2, 8:23 pm, spicyj [EMAIL PROTECTED] wrote: This might be helpful: http://pastie.org/226790// shamelessly stolen from the Masked Input plugin $(:text).bind(focus, function() { $(this).caret(this.value.length); }); Not tested, so I don't know if it works, but it might.
[jQuery] Re: Position cursor at end of textbox?
OK, I was a little premature in my judgment. But why add a new function to jQuery when it will only be used once in your code? That's kind of silly. On Jul 3, 10:58 am, h3 [EMAIL PROTECTED] wrote: $.extend($.fn, { selectRange: function(start, end) { // use only the first one since only one input can be focused if ($(this).get(0).createTextRange) { var range = $(this).get(0).createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', start); range.select(); } else if ($(this).get(0).setSelectionRange) { $(this).focus().get(0).setSelectionRange(start, end); } return $(this); } }); I think it's pretty much the best crossbrowser solution you will find. $('input').selectRange(0,0) to reset the carret position, to position it at the end you will need to get length of the input's value.. you just made me think I could add support for -1, thanks :D ~h On Jul 2, 2:55 pm, Paul Malan [EMAIL PROTECTED] wrote: By default it seems browsers select all the text in a textbox when it gains focus by way of a tab-press. I would like the cursor to be positioned at the end of any existing text in the input, instead. The examples I'm turning up on Google don't work and seem needlessly complex, and since jQuery simplifies everything else I used to hate about Javascript, I thought I'd see if there's a simple way to position the cursor in a text input box on focus. Is it doable? Thanks...
[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6
Darren, I found the actual problem. It wasn't the lack of {} in the grep method - that was a red herring. (There's nothing wrong with the grep method that {} would fix.) Your page is loading script.aculo.us effects.js v1.7.1_beta3. This file defines Array.prototype.call as a function. That causes massive confusion inside jQuery 1.2.6, but not in 1.2.3. The reason is the change that was made to jQuery's makeArray() function in 1.2.6 - if the code is passed an array that has a call method, it mistakenly thinks it is not an array and does the wrong thing - line 1135 of jquery-1.2.6.js is the pertinent code here. (The correct fix isn't immediately obvious, but I'll file a ticket on this.) As it happens, the current version of script.aculo.us effects.js, v1.8.1, no longer defines Array.prototype.call. Can you upgrade to the latest version of prototype.js and the various script.aculo.us files you're including? That would fix the problem. But are you actually using script.aculo.us and prototype.js in your code at all? I noticed that there is no jQuery.noConflict() call in your code, which means that including jQuery would break any prototype/script.aculo.us code because of the conflict over the $() function. I tried removing all the script.aculo.us and prototype script tags and didn't see any errors on the page. So if you're not using them, you could just remove these files. -Mike
[jQuery] Fade in, out, then in?
So I want to be able to fadeIn an element (#logo), then fadeOut the same element, then fadeIn a different element (#content). So the logo fades in, then out, then the content fades in. I've already got the logo fading part: $(#logo).fadeTo(1000, 0).fadeIn(1000) .fadeTo(4000, 1).fadeOut(1000); But no matter what I do, I can't make the content fade in smoothly after the logo fading is finished (about 7 seconds). The logo fades in then out in the very center of the page, and I want the content to fade in (not out) in the same spot. Is this possible? If so, how would I go about doing it?
[jQuery] Re: jQuery not setting X-Requested-With XMLHttpRequest
From what I can tell, I've now fixed this in my code. What's frustrating is that I don't believe I changed anything (but obviously something must have). I added some alerts into the jQuery code itself to see if it was truly setting the request header, and then as soon as I did that, it started working! Taking those out, everything still works. So, uh, I'm left wondering... On Thu, Jul 3, 2008 at 2:56 PM, duck! [EMAIL PROTECTED] wrote: Does setting the contentType work? http://docs.jquery.com/Ajax/jQuery.ajax#options Chris Bailey-4 wrote: I'm using jQuery 1.2.6, and I can't seem to get jQuery to set the X- Requested-With when it makes AJAX calls. I saw somewhere that this may have to do with cross-site issues if the host is specified in the URL. I've tried skirting around that by just passing a relative URL, but with no success. I'm wondering what I might be doing wrong, or if someone can point me in the right direction. Here's what my jQuery code looks like: $.ajax({ type: POST, url: '/votes/43', dataType: html, data: method=delete, success: function(data) { $(this).parents('div.vote_box').after(data).remove(); } }); I've tried it also by adding a beforeSend, of: beforeSend: function(xhr) { xhr.setRequestHeader(X-Requested-With, XMLHttpRequest); }, I've inspected the request headers with Firebug and with a separate HTTP tracing tool, and the X-Requested-With header is never present. The host, when I'm debugging like this is http://localhost:3000;, or I've also tried with http://localhost; (i.e. just running on 80). I've tried this in both Firefox 3 and Safari. -- View this message in context: http://www.nabble.com/jQuery-not-setting-X-Requested-With-XMLHttpRequest-tp18264663s27240p18268977.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Chris Bailey [EMAIL PROTECTED]
[jQuery] Re: how to load and change the external HTML fragment with AJAX
Can you post a webpage with a simple example? Thanks! xasima wrote: Hi, I want to load a fragment of external html document (external.html#embeddedContent) with the help of AJAX call, embed (inject) this into my HTML document (main.html#placeToInject), and change this embedded fragment a little. I think that I need load this external fragment and either 1) change this before injection, or 2) inject and change at once before user will notice anything. The both possibilities are ok for me now, but I have a problem with manipulating and filtering the embedded fragment while working with jquery 1.2.1. If I follow the second (2) way, I need to do any manipulation only when content has been already injected into the code. But the following code doesn't work. Means $('..') below relates to original fragment in main.html that has been presented there before injection. See comments in the code. $(document).ready(function(){ // load and inject content var content = main.html; $(#placeToInject).load(content + #embeddedContent *); // change the loaded fragment // here $('..') relates to original fragment in main.html (before injection). $(#placeToInject .price).addClass(bold); }); If I follow the first (1) way, I need to have the access to just loaded document (DOM). So I need to attach these manipulation actions to the event that show that the ajax call has been successfully completed. I have tried to do the POST instead GET (since I don't know how to use the load function with GET and attached function). But I can't filtering the classes (element with given class) in the fragment. See the comment in the code. $(document).ready(function(){ // load content var embeded = embedded.html; $(#placeToInject).load(embeded + #embeddedContent *, null,function(){ // it doesn't want to match the classes (means elements with class='price') that are located into the loaded fragment $(this).filter(.price).addClass(bold); }); }); I think that it possible to try function .ajaxSuccess( function(evt, request, settings){ alert($(this).filter(#left-side).html()); }); But I don't know how to prepare the rest of the parameters for my needs, right now. Please provide me feedback, if I properly use the functions above and how may I fix that problems. Thanks
[jQuery] Re: Fade in, out, then in?
Hi Miiitch, You can put the content fade in the callback of the last logo fadeOut. // ... .fadeOut(1000, function() { $('#content').fadeIn(1000); }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 3, 2008, at 6:09 PM, Miiitch wrote: So I want to be able to fadeIn an element (#logo), then fadeOut the same element, then fadeIn a different element (#content). So the logo fades in, then out, then the content fades in. I've already got the logo fading part: $(#logo).fadeTo(1000, 0).fadeIn(1000) .fadeTo(4000, 1).fadeOut(1000); But no matter what I do, I can't make the content fade in smoothly after the logo fading is finished (about 7 seconds). The logo fades in then out in the very center of the page, and I want the content to fade in (not out) in the same spot. Is this possible? If so, how would I go about doing it?
[jQuery] Dynamically Added Select not submitted
I have some code that creates SELECT HTML dynamically using jQuery (verified with alert() and DOM Inspector). It works as expected in IE, but in Firefox the dynamically added SELECTs are not submitted with the form. Is this a known bug? I am tearing my hair out trying to figure this one out. Here is the code snippet that appends the new SELECT: ele = virginAttrRule.clone(); $([EMAIL PROTECTED]'name_'],ele)[0].name = 'name_'+iCount; $([EMAIL PROTECTED]'value_'],ele)[0].name = 'value_'+iCount; $([EMAIL PROTECTED]'condition_'],ele)[0].name = 'condition_'+iCount; ... $(#rules).append(ele); virginAttrRule is a clone of a DIV tag that contains 3 SELECT tags (name_,value_,condition_). #rules is the parent TD tag.
[jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
Hi there, No, there's no difference. They both have the exact same effect. But there's a reason why plugin developers use enclosures of that kind. They do it to make sure they can use $ instead of jQuery even when the user is using jQuery.noConflict(). Perhaps you want to isolate your own variables within an anonymous function, but unless you're using jQuery.noConflict(), you don't actually need to do this at all. I hope that clears up any confusion... Diego 2008/7/3 jfine [EMAIL PROTECTED]: On 3 Jul, 21:35, Michael Geary [EMAIL PROTECTED] wrote: Yes, either one will do exactly the same thing. It's purely a matter of taste. Thank you both for this. I think Michael right, but perhaps Diego would like to response - he thinks there is a difference. Thank you also Michael for the semicolon warning. I'm now using js2- mode.el with Emacs. It warns me about such errors. -- Jonathan -- Cheers, Diego A.
[jQuery] Re: jQuery not setting X-Requested-With XMLHttpRequest
Use this: $.ajaxSetup({ headers: {X-Requested-With:Ajax} }); Diego 2008/7/3 duck! [EMAIL PROTECTED]: Does setting the contentType work? http://docs.jquery.com/Ajax/jQuery.ajax#options Chris Bailey-4 wrote: I'm using jQuery 1.2.6, and I can't seem to get jQuery to set the X- Requested-With when it makes AJAX calls. I saw somewhere that this may have to do with cross-site issues if the host is specified in the URL. I've tried skirting around that by just passing a relative URL, but with no success. I'm wondering what I might be doing wrong, or if someone can point me in the right direction. Here's what my jQuery code looks like: $.ajax({ type: POST, url: '/votes/43', dataType: html, data: method=delete, success: function(data) { $(this).parents('div.vote_box').after(data).remove(); } }); I've tried it also by adding a beforeSend, of: beforeSend: function(xhr) { xhr.setRequestHeader(X-Requested-With, XMLHttpRequest); }, I've inspected the request headers with Firebug and with a separate HTTP tracing tool, and the X-Requested-With header is never present. The host, when I'm debugging like this is http://localhost:3000;, or I've also tried with http://localhost; (i.e. just running on 80). I've tried this in both Firefox 3 and Safari. -- View this message in context: http://www.nabble.com/jQuery-not-setting-X-Requested-With-XMLHttpRequest-tp18264663s27240p18268977.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Cheers, Diego A.
[jQuery] Re: Validation and Tabs plugins compatibility
Hi, This is just an idea (which I haven't checked) but since you have JS experience I'm just gonna throw it at you. The validation plugin adds an 'error' class to all problem fields. You could very quickly loop through each tab, look for an error and (if found), change the focus to that tab. something like... $('#my-tabs div').each(function(i){ if($('.error', this).length0) $(this).tabs('activate', i); }); I'm not sure that 'activate' is the right action for the tabs plugin, you'll have to check the documentation... Cheers, Diego A. 2008/7/3 peace4theapes [EMAIL PROTECTED]: Hello all, I am just switching to JQuery from prototype and am trying to use the Validation and Tabs plugins for JQuery. Here's my problem: I have one form tag in which I have my tabs container. Using a dynamic language I am creating multiple tabs for user chosen data, say states. So if the user has chosen 5 states, there are five tabs with the same form fields with the _statename appended to the end of the field name. So, if the user enters data, validates the form and click on continue nothing happens as the user has not touched the other tabs. But, the user doesn't know about this and it is a confusion. Is there a way to select the right tab depending on which tab the validator throws an error in? Any help would be greatly appreciated. I am using the following code: script type=text/javascript $(function() { $('##tabs_container ul').tabs({ fx: { opacity: 'toggle' } }); }); /script script type=text/javascript $().ready(function() { $(##general).validate({ rules: { cfloop list=#stateslist# index=sta cfset sta = ReplaceNoCase(sta,' ','','All') products_#sta#: required osda_#sta#: required, /cfloop }, messages: { cfloop list=#stateslist# index=sta cfset sta = ReplaceNoCase(sta,' ','','All') products_#sta#: Choose product; osda_#sta#: Please choose YES OR NO. /cfloop } }); }); /script Thanks -P -- Cheers, Diego A.
[jQuery] Re: how to load and change the external HTML fragment with AJAX
Inside the load callback, change $(this).filter(.price).addClass(bold); to $(this).find(.price).addClass(bold); or $(.price, this).addClass(bold); - Richard On Thu, Jul 3, 2008 at 5:33 PM, xasima [EMAIL PROTECTED] wrote: Hi, I want to load a fragment of external html document (external.html#embeddedContent) with the help of AJAX call, embed (inject) this into my HTML document (main.html#placeToInject), and change this embedded fragment a little. I think that I need load this external fragment and either 1) change this before injection, or 2) inject and change at once before user will notice anything. The both possibilities are ok for me now, but I have a problem with manipulating and filtering the embedded fragment while working with jquery 1.2.1. If I follow the second (2) way, I need to do any manipulation only when content has been already injected into the code. But the following code doesn't work. Means $(..) below relates to original fragment in main.html that has been presented there before injection. See comments in the code. $(document).ready(function(){ // load and inject content var content = main.html; $(#placeToInject).load(content + #embeddedContent *); // change the loaded fragment // here $(..) relates to original fragment in main.html (before injection). $(#placeToInject .price).addClass(bold); }); If I follow the first (1) way, I need to have the access to just loaded document (DOM). So I need to attach these manipulation actions to the event that show that the ajax call has been successfully completed. I have tried to do the POST instead GET (since I don't know how to use the load function with GET and attached function). But I can't filtering the classes (element with given class) in the fragment. See the comment in the code. $(document).ready(function(){ // load content var embeded = embedded.html; $(#placeToInject).load(embeded + #embeddedContent *, null,function(){ // it doesn't want to match the classes (means elements with class=price) that are located into the loaded fragment $(this).filter(.price).addClass(bold); }); }); I think that it possible to try function .ajaxSuccess( function(evt, request, settings){ alert($(this).filter(#left-side).html()); }); But I don't know how to prepare the rest of the parameters for my needs, right now. Please provide me feedback, if I properly use the functions above and how may I fix that problems. Thanks
[jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()?
Sorry, Diego, but you may have made things more confusing! :-) If you change enclosures of that kind to enclosures of either kind it will probably be more clear. As you said, there isn't any real reason for plugin developers to prefer one of these two forms over the other. It's just a matter of historical accident. I posted a message in this group a couple of years ago that mentioned the (function($){...})(jQuery); approach, and everybody liked it and started using it in their plugins. It could have just as easily been the (function(){var $=jQuery;...})(); version. Regarding the comment that there may not be any need to do this other than the noConflict thing - actually I do it all the time just to get a local scope for some variables. I don't want to put variables into the global namespace when I can avoid it. -Mike _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Diego A. Sent: Thursday, July 03, 2008 6:44 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Why (function($){ ...})(jQuery) instead of (function(){var $ = jQuery; ...})()? Hi there, No, there's no difference. They both have the exact same effect. But there's a reason why plugin developers use enclosures of that kind. They do it to make sure they can use $ instead of jQuery even when the user is using jQuery.noConflict(). Perhaps you want to isolate your own variables within an anonymous function, but unless you're using jQuery.noConflict(), you don't actually need to do this at all. I hope that clears up any confusion... Diego 2008/7/3 jfine [EMAIL PROTECTED]: On 3 Jul, 21:35, Michael Geary [EMAIL PROTECTED] wrote: Yes, either one will do exactly the same thing. It's purely a matter of taste. Thank you both for this. I think Michael right, but perhaps Diego would like to response - he thinks there is a difference. Thank you also Michael for the semicolon warning. I'm now using js2- mode.el with Emacs. It warns me about such errors. -- Jonathan -- Cheers, Diego A.
[jQuery] Cluetip: Why isn't my top left graphic displaying in my tip?
I finally have everything pretty much figured out for my initial ClueTip experience. Except for this one. Check the tips out here: http://www.datatv.com/sw/SW_wp_sampler2.html Now, I've only tested these in Firefox and Safari but the tl.gif isn't displaying even though I click on the View Background Image and I see my image. Here it is: http://www.datatv.com/sw/images/tl.gif So why don't I see it in my tip or is it just my computer driving me nuts?
[jQuery] CSS Dropdown Menu showing up as white box in IE6.
I'm trying to wrap up a site for a client and I've had this big issue with the dropdown menu I created using JQuery as it's fine everywhereexcept (of course) in Internet Explorer 6. There it shows up as a white box and that's it. I've seen similar menus work in IE6 but can't figure out what the hack (yes, I said what the 'hack') it's supposed to be. Anyone else have an experience like this: http://reggae.esolutions.net/~granolag/index.html Any help would be greatly appreciated.
[jQuery] Re: Dynamically Added Select not submitted
Solution found. I had the FORM tag nested to far up the DOM tree. Kinda weird as the form elements where still within the FORM tags.
[jQuery] blockUI fadeOut
hello, is the blockUI fadeout function working? I was unable to get it to fadeOut fast. (0 fadeOut) Here is an excerpt: $.blockUI({ centerX: true, centerY: 0, message: $('#inRum'), css: { top: '200px', width: '300px', border: '5px solid #535353', padding: '10px', backgroundColor: '#fff', '-webkit-border-radius': '20px', '-moz-border-radius': '20px', opacity: '1', color: '#000' }, fadeOut: 0, fadeTime: 0 }); what is wrong?
[jQuery] Re: DELETE HTTP method
So, real REST is impossible, because of browser limitations? And to make correct cruD in REST I must use GET/POST only, right? And another question: but WHY jQuery doesn't process 'DELETE' method as 'GET': it doesn't parse data to result url. It do it only for POST and GET. OK, not all browsers support it, but why jQuery doesn't support other HTTP methods in principle? /Pavel Yosifov
[jQuery] Re: Jquery validation
Jörn It is working thanks for your support . On Jul 2, 11:25 pm, konda [EMAIL PROTECTED] wrote: Thanks a lot I will try On Jul 2, 5:59 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: Take a look at the highlight/unhighlight options! Documented here:http://docs.jquery.com/Plugins/Validation/validate#toptions Jörn On Wed, Jul 2, 2008 at 10:39 PM, konda [EMAIL PROTECTED] wrote: HI, We are trying to use Jquery validation plugin for client side validation. It is working okay. The error message displays if the form validation fails. But we need the error display to highlight the entire row including the label and the input element. Is there a way to do this in JQuery Validation plugin? div label for=firstnameFirstname/label input id=firstname name=firstnamet / /div Basically we need to color the entire div element red.
[jQuery] Re: DELETE HTTP method
Hmm, after googling I saw that problems not in XMLHttpRequest - it can do DELETE in all browsers. Richard, you mean HTML forms only? But I mean DELETE via ajax in jQuery without any forms...
[jQuery] Re: update to 1.2.6 returns different result when retrieving onchange attribute
That surely never worked on IE. Setting strings as inline events handlers has no effect when on IE. -- Ariel Flesler http://flesler.blogspot.com/ On 3 jul, 12:03, Jack [EMAIL PROTECTED] wrote: Folks, I had been using jQuery 1.2.3 and had code like this working: if ($(this).attr(onchange)) { var funcCall = new String($(this).attr(onchange)); //alert(funcCall); if (funcCall.search(/^changedDestination/) || funcCall.search(/ ^changedDeliverableResolution/) || funcCall.search(/^changedPersonalItem/)) { var result = funcCall.match(/(.+),0\)/); if (result != null){ var newFuncCall = result[1]+','+unitTabCount+')'; $(this).attr(onchange,newFuncCall); } } } The value of funcCall would contain the string of text in the quotes for the onchange attribute of a select element, which might look like this: changedPersonalItem(this,'text',0) Now after upgrading to version 1.2.6, when I execute this code the value of funcCall contains this: function onchange(event) { changedPersonalItem(this,'text',0); } Does anyone know how I would be able to retrieve the text I was originally getting without the added function text wrapped around it? In case it matters, I'm testing/developing on a Mac OS 10.4 system using FireFox 2.0.0.15.
[jQuery] FlexiGrid Problem
Hi All, I using two instances of FlexiGrid in a page and I'm encountering the below error on the pagination stat: Page of [object Object] What do you think causes the error? By the way this error appears only on FF. It is not displaying on IE but still there is an error (records don't appear). Thanks, Nimrod