[jQuery] Re: Notification when content was updated via AJAX
The Live Query plugin may help in this circumstance: http://plugins.jquery.com/project/livequery --Sam On Dec 1, 12:43 pm, Raphael [EMAIL PROTECTED] wrote: I'm having a little problem: There are two independent modules (I'm working in a drupal environment). Well, one module polls a table via AJAX request and the other module provides some services when a tr element has been clicked. BUT: On Pageload the click event is bound to the tr element. When the first module though polls in a new table, this table doesn't have the click event attached. What I need. My second module needs to somehow know when new content comes in via AJAX, so it can bind the click element to them. Is there some way to accomplish this? Thanks Raphael
[jQuery] Re: show many news in one screen instead of one with Newsticker
Not tested this yet, but the code would need to be tweaked. Change el.items = $(li, el); to el.items = $( li, el); And then use lists within lists: ul id=news liul liNews 1/li ... liNews 10/li /ul/li liul liNews 11/li ... liNews 20/li /ul/li /ul Hope this helps. -- Sam On Oct 10, 10:44 am, RDB [EMAIL PROTECTED] wrote: Hello, I’m using Newsticker (http://www.texotela.co.uk) in my site, I would like to know how to show multiple news per each screen instead of only one in this plugin. I'd like to show 10 news by 10 because of their big number. Any idea on how to make this ? Thanks a lot Jquery code : script type=text/javascript (function($) { /* * A basic news ticker. * * @name newsticker (or newsTicker) * @param delay Delay (in milliseconds) between iterations. Default 4 seconds (4000ms) * @author Sam Collett (http://www.texotela.co.uk) * @example $(#news).newsticker(); // or $ (#news).newsTicker(5000); * */ $.fn.newsTicker = $.fn.newsticker = function(delay) { delay = delay || 4000; initTicker = function(el) { stopTicker(el); el.items = $(li, el); // hide all items (except first one) el.items.not(:eq(0)).hide().end(); // current item el.currentitem = 0; startTicker(el); }; startTicker = function(el) { el.tickfn = setInterval(function() { doTick(el) }, delay) }; stopTicker = function(el) { clearInterval(el.tickfn); }; pauseTicker = function(el) { el.pause = true; }; resumeTicker = function(el) { el.pause = false; }; doTick = function(el) { // don't run if paused if(el.pause) return; // pause until animation has finished el.pause = true; // hide current item $(el.items[el.currentitem]).fadeOut(slow, function() { $(this).hide(); // move to next item and show el.currentitem = ++el.currentitem % (el.items.size()); $(el.items[el.currentitem]).fadeIn(slow, function() { el.pause = false; } ); } ); }; this.each( function() { if(this.nodeName.toLowerCase()!= ul) return; initTicker(this); } ) .addClass(newsticker) .hover( function() { // pause if hovered over pauseTicker(this); }, function() { // resume when not hovered over resumeTicker(this); } ); return this; }; })(jQuery); $(document).ready( function() { $(#news).newsTicker(2000); } ); /script HTML code : !-- Begin HTML code -- ul id=news lifirst news/li lisecond news/li lithird news/li li.../li li50th news/li /ul !-- end HTML code --
[jQuery] Re: show many news in one screen instead of one with Newsticker
Not tested this yet, but the code would need to be tweaked. Change el.items = $(li, el); to el.items = $( li, el); And then use lists within lists: ul id=news liul liNews 1/li ... liNews 10/li /ul/li liul liNews 11/li ... liNews 20/li /ul/li /ul Hope this helps. -- Sam On Oct 10, 10:44 am, RDB [EMAIL PROTECTED] wrote: Hello, I’m using Newsticker (http://www.texotela.co.uk) in my site, I would like to know how to show multiple news per each screen instead of only one in this plugin. I'd like to show 10 news by 10 because of their big number. Any idea on how to make this ? Thanks a lot Jquery code : script type=text/javascript (function($) { /* * A basic news ticker. * * @name newsticker (or newsTicker) * @param delay Delay (in milliseconds) between iterations. Default 4 seconds (4000ms) * @author Sam Collett (http://www.texotela.co.uk) * @example $(#news).newsticker(); // or $ (#news).newsTicker(5000); * */ $.fn.newsTicker = $.fn.newsticker = function(delay) { delay = delay || 4000; initTicker = function(el) { stopTicker(el); el.items = $(li, el); // hide all items (except first one) el.items.not(:eq(0)).hide().end(); // current item el.currentitem = 0; startTicker(el); }; startTicker = function(el) { el.tickfn = setInterval(function() { doTick(el) }, delay) }; stopTicker = function(el) { clearInterval(el.tickfn); }; pauseTicker = function(el) { el.pause = true; }; resumeTicker = function(el) { el.pause = false; }; doTick = function(el) { // don't run if paused if(el.pause) return; // pause until animation has finished el.pause = true; // hide current item $(el.items[el.currentitem]).fadeOut(slow, function() { $(this).hide(); // move to next item and show el.currentitem = ++el.currentitem % (el.items.size()); $(el.items[el.currentitem]).fadeIn(slow, function() { el.pause = false; } ); } ); }; this.each( function() { if(this.nodeName.toLowerCase()!= ul) return; initTicker(this); } ) .addClass(newsticker) .hover( function() { // pause if hovered over pauseTicker(this); }, function() { // resume when not hovered over resumeTicker(this); } ); return this; }; })(jQuery); $(document).ready( function() { $(#news).newsTicker(2000); } ); /script HTML code : !-- Begin HTML code -- ul id=news lifirst news/li lisecond news/li lithird news/li li.../li li50th news/li /ul !-- end HTML code --
[jQuery] Re: Plugin that offers smart tag-like functionality?
Thought someone might have done something like this. HTML would be something like this: div id=smarttag div id=smarttagicon img src=smarttagicon.gif width=16 height=16 / /div div id=smarttagcontent ul lia href=#Action 1/a/li lia href=#Action 2/a/li /ul /div /div And jQuery (kind of works, but not in IE and doesn't hide if hovering over the content and out without going over the icon first): $(smarttags); function smarttags() { $(#smarttagicon).hover( function() { $(#smarttagcontent).show(); },function(e) { // if not over the smarttag div, hide content if(!$(e.relatedTarget).parents(#smarttag).length) { $(#smarttagcontent).hide(); } } ); } The 'smarttag' div would be hidden initially, but populated and shown when hovering over an element that it is applied to. I suppose a smart tag is an extension of a tooltip (which doesn't disappear if you mouse over it). -- Sam On Sep 25, 5:07 pm, Rey Bango [EMAIL PROTECTED] wrote: Anyone know of a plugin that offers functionality like this? http://en.wikipedia.org/wiki/Image:Smarttags.PNG Rey...
[jQuery] Re: New jQuery Website...
As much as we don't like it, sites still have to be designed to cater for IE 6+ We are still on IE 6 at work, because some of the systems we use (not ones I have worked on of course!) only seem to work in IE 6. You would have thought when you pay for a system, it is updated as new browsers come out... should be in the Service Level Agreement. I'm sure there are still a lot of corporate intranet's still depending on IE 6 (developers not caring about standards or really understanding web development outside the GUI used...) -Sam PS While IE7 may have some annoyances (Firefox does too), it is still much better (standards wise) than IE6 jeremyBass wrote: I don't know if this is just me but the site is all kinds of broken... I'mean in almost everywere... this is 2 IE7's and 1 IE6's on 3 pcs... I'd give a url but ... well it's almost everywhere... cool idea though... On Sep 8, 10:03�am, Rick Faircloth [EMAIL PROTECTED] wrote: Yes, it does look great! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Chris Jordan Sent: Monday, September 08, 2008 12:58 PM To: jQuery Group Subject: [jQuery] New jQuery Website... I really like the look of the new jQuery website. When did it get launched? My hats off to the designers! It looks fantastic!! :o) Chris --http://cjordan.us No virus found in this incoming message. Checked by AVG -http://www.avg.com Version: 8.0.169 / Virus Database: 270.6.17/1655 - Release Date: 9/8/2008 7:01 AM
[jQuery] Store JSON object in cookie
If you try and store and retrieve a JSON object in a cookie using the cookie plugin (http://plugins.jquery.com/project/cookie), you get an unexpected result. For instance, save into cookie: $.cookie(mydata, {foo:bar,baz:1}); Retrieve value: var mydata = $.cookie(mydata); But that returns [object Object] A json parser (e.g. http://www.json.org/js.html) has to be used. Using this script, you can 'stringify' the object before storing it: $.cookie(mydata, JSON.stringify({foo:bar,baz:1})); Then you retrieve it and use JSON.parse: var mydata = JSON.parse($.cookie(mydata)); While this is a workaround, perhaps it may be a good idea if the cookie plugin did this automatically (i.e. convert object to string and back again)? Rather than building in JSON parsing, maybe make the json.org parser a prerequisite? Then a check is done in the plugin code: if(typeof JSON != undefined) { if(typeof value == object) value = JSON.stringify(value); }
[jQuery] jQuery.post returning binary content
I current add a form to the page, which is then submitted and returns binary content (e.g. a PDF or Word/RTF Document) that causes a prompt for them to open/download the file: var form = $(document.createElement(form)).attr( { method: post, action: getdocument.ashx }).html(input type='hidden' name='RecordID' value='1'); $(body).append(form); form[0].submit(); The getdocument.ashx returns the following headers to cause the download dialog to appear: content-type = application/rtf content-disposition = attachment; filename=Record1.rtf Is there a way to use jQuery.post instead, I have tried the following, to no avail (I can see the response in Firebug, so the file is downloaded, but the user can't download it): $.post(getdocument.ashx, { RecordID: 1 } ); Thanks, --Sam
[jQuery] Re: My first jQuery plugin
How about: $(#myelement).parents(table:eq(0)) Does that do what you want? Example: http://demos.texotela.co.uk/parents.html --Sam On Jul 17, 7:51 am, ProggerPete [EMAIL PROTECTED] wrote: Hi Andy, parents doesn't do quite what I want. I want a method I can use in event delegation handlers that basically says, 'Give me the nearest x element'. I could of course check the current element, if it doesn't match I could then do a parents and then work on the 1st result in that, but that would be a bunch of extra processing for no gain (while it continues to check parents that I have no interest in). I was more after info about any silly things I've done while implementing the function. I've since discovered pushStack which helps a fair bit. =) Cheers, Pete On Jul 15, 6:19 pm, Andy Matthews [EMAIL PROTECTED] wrote: Pete... There is a built in parent method which does pretty much what you're doing. http://remysharp.com/jquery-api/ Look under parents(). -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ProggerPete Sent: Tuesday, July 15, 2008 10:41 AM To: jQuery (English) Subject: [jQuery] My first jQuery plugin Hi folks, I'm very new to jQuery and am playing around with what is possible. I found myself wanting a findParent function and couldn't spot one ready made. I'd love it if people could give me feedback on my implementation. I'm sure there's plenty I could do better. If this function also exists I'd like to know where it is too. =) /** * return the first parent that matches the selector. Optionally include the src element in the search */ $.fn.findParent = function() { var _this, _selector, _includeSelf, _result; function find(index, elem) { if (!_includeSelf) elem = elem.parentNode; while (elem) { if ($(elem).is(_selector)) return _result.push(elem); elem = elem.parentNode; } } function _findParent(selector, includeSelf) { var thisp = _this = this; _selector = selector; _includeSelf = includeSelf; _result = []; this.each(find); var retObj = $(_result); retObj.end = function () { return thisp }; return retObj; } return _findParent; }(); Cheers, Pete
[jQuery] Re: Declaring Rules in ASP.Net
All ASP.NET controls have a ClientID, which matches the ID generated in the HTML, so you should be able to replace: % = namePostcode % with %= namePostcode.Replace(:,\:) % and $([EMAIL PROTECTED] + %=chkLinkAccount.ClientID % + ]) with $(#%=chkLinkAccount.ClientID %) --Sam On Jul 17, 7:46 am, Gregoriusness [EMAIL PROTECTED] wrote: Hey all, I'm trying to implement validation using the Validation plugin on an ASP.Net (1.1 :( ) form. I'm having trouble with setting up the rules, because they require the form element's name tag to assign the rule to, and ASP.Net does some funky stuff with the names (changes a name=myname to myUserControl:myname). I can get that client side name by calling the name the same as the ID, and on server side getting the fomrelement.ClientID, then doing a String.Replace(_, :). But now it seems JQuery doesnt like that name because it has a colon (:) in it. Putting quotation marks around it in the rules declaration doesn't seem to help. Any ideas how i can get my rules working successfully? My best solution would be fore the rules to accept a javascript variable (which contains the actual element name) which i can declare at the top of my page, and get the ClientID Client Name values for use later on. Or alternatively telling Validation plugin to use ID instaed of Name attribute. Here's my code: $().ready(function() { $(#Short).validate({ rules: { % = namePostcode %: { required: function() { return $([EMAIL PROTECTED] + % =chkLinkAccount.ClientID % + ]).is(:checked); } } }, messages: { % = namePostcode %: { required: Please enter your postcode } }, errorPlacement: function(error, element) { if ( element.is(:checkbox) ) error.appendTo( element.parent()); else error.appendTo( element.parent() ); } }); Whic Generates the following: $().ready(function() { $(#Short).validate({ rules: { ucFoxtelAccount:txtPostcode: { required: function() { return $([EMAIL PROTECTED] + ucFoxtelAccount_chkLinkAccount + ]).is(:checked); } } }, messages: { ucFoxtelAccount:txtPostcode: { required: Please enter your postcode } }, errorPlacement: function(error, element) { if ( element.is(:checkbox) ) error.appendTo( element.parent()); else error.appendTo( element.parent() ); } }); And is trying to validate the following form element: div class=fieldcontainer div class=fieldlabel Accountholder Postcode: /div div class=fieldmandatory*/div div class=fieldinput postcode input name=ucFoxtelAccount:txtPostcode type=text maxlength=4 id=ucFoxtelAccount_txtPostcode class=required numeric textbox postcode MinLength=4 / /div /div Thanks in advance Greg
[jQuery] Re: YouLove.us crazy cool.
Lags a bit with me as well, site looks quite good though. It is actually smoother without JavaScript enabled. It illustrates that when developing sites/applications it is a good idea to test with a slower PC (it is likely a lot of developers have above average specification computers). -Sam On Jun 16, 3:10 pm, Joe [EMAIL PROTECTED] wrote: Interesting. I dig the dynamic parallax effect, but the transitions are a bit jagged. Maybe a fade in fade out? Overall cool stuff. Joe www.subprint.com On Jun 16, 8:07 am, Ty (tzmedia) [EMAIL PROTECTED] wrote: Did anyone else see the newhttp://youlove.usdesign-houseportfolio site? It's pretty cutting edge stuff, worth a study.
[jQuery] Re: Documentation for Version 1.2 (Download)
There is a special page for converting WikiText to XML: http://docs.jquery.com/Special:Wiki2XML If the Wiki has built in features for converting to XML, perhaps it could be leveraged somehow? As DocBook is one of the output formats, there are more options for creating documentation. If MediaWiki is used to power the site (I assume it is), there are options for converting to a PDF (so skipping the XML step): http://www.mediawiki.org/wiki/Extension:Pdf_Export http://wiki.enneenne.com/index.php/MediaWiki_PDF_export http://meta.wikimedia.org/wiki/PDF_Export -Sam PS CC-ing to jQuery Documents list as it seems appropriate to do so On Jun 6, 1:14 pm, Richard D. Worth [EMAIL PROTECTED] wrote: You may want to take a look at this thread: Wiki xml exporterhttp://groups.google.com/group/jquery-dev/browse_thread/thread/d08934... It's a few months old, so I don't know how up-to-date any referenced code might be (for converting from mediawiki to xml), but at the very least there are urls listed for accessing the raw documentation from mediawiki. - Richard On Fri, Jun 6, 2008 at 7:59 AM, gogui [EMAIL PROTECTED] wrote: Hello, I am looking for documentation I can download and have accessible offline. I understand that visualJQuery and JQuery 1.1.2 API Browsers are available for download, however, they are outdated. Is there and RSS feed for the documentation provided at JQuery.com itself? (I am willing to port the raw data to an application). Thanks
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
Looks like another good release, yet more performance improvements and a few useful new features! Regarding speed testing, maybe it is worth mentioning the PC specification of the machine that performs these tests? For example, mine (Core Duo 1.6Ghz) .extend() 1.2.3 - 63 1.2.6 - 46 .map() 1.2.3 - 2268 1.2.6 - 203 Still a performance improvement, but not as great as the test machine - i.e. the faster the client PC processor, the better the performance improvement (I don't think RAM will have much of an impact as the CPU is doing the work). Perhaps the tests should be done on different spec machines, more so the low end ones (Celeron, Sempron and Intel Atom)? -Sam On Jun 3, 6:46 pm, Rey Bango [EMAIL PROTECTED] wrote: jQuery v1.2.6 is now official and release notes have been posted:http://docs.jquery.com/Release:jQuery_1.2.6 The biggest changes are improvements in performance, especially event handling, which is now 103% faster. Also, the Dimensions plugin is now part of core. The remaining methods of the Dimensions plugin, by Brandon Aaron, have been introduced into jQuery core, along with additional bug fixes and performance improvements. This plugin has seen considerable use amongst developers and plugin authors and has become a solid part of the jQuery ecosystem. We've been, slowly, introducing the most-used methods from the Dimensions plugin over the past couple releases - but with the release of 1.2.6 all remaining methods are now part of core. If you're upgrading your copy of jQuery to version 1.2.6 you can now opt to exclude the Dimensions plugin from your code. There are plenty of other updates so please read the release note for full details. http://docs.jquery.com/Release:jQuery_1.2.6 The jQuery Team...
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
I suppose a few % points off isn't that much of a difference and in some cases were even better. But I expect mine isn't too far off the test machine. Think I got my maths the wrong way round: ((1.2.3 time - 1.2.6 time) / 1.2.3 time) * 100 e.g. for .extend(): ((63 - 46) / 63) * 100 (17 / 63) * 100 = 27% improvement Maybe that's why I made that conclusion. What I am interested in is how the lower spec PC's performed (non-dual core, entry level machines), to see if multi-core processors actually make much of a difference (since many users of website using jQuery will have these type of PC's). .map() is the major improvement in this release as a few milliseconds off a fast method like .extend() won't mean as much (although if it is called a lot it adds up to more savings). .offset() is still a bottleneck (browser quirks stop any major improvements), but caching values and restricting how often it is called helps mitigate that (I think Flash is still far smoother when it comes to mouse tracking and animation - which can be very slow over a Citrix connection). Animation performance is not something that can be tested with unit tests (still need a human to do that). How does it compare with other libraries now? -Sam On Jun 4, 1:21 pm, John Resig [EMAIL PROTECTED] wrote: Still a performance improvement, but not as great as the test machine - i.e. the faster the client PC processor, the better the performance improvement (I don't think RAM will have much of an impact as the CPU is doing the work). How so? Your .extend() improved by 37% and your .map() improved by 1017%. Those are well within the realm of what we posted. The speed of the processor shouldn't affect the degree of relative improvement. --John
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
Mainly CSS selector tests, but perhaps also methods that may be common among libraries (like map, extend), but that may be more difficult. There is this one, but it uses old libraries (not just jQuery): http://dev.jquery.com/~john/slick/ -Sam On Jun 4, 3:52 pm, John Resig [EMAIL PROTECTED] wrote: .extend() was used extensively in the event handling code, hence the need for improvement. How does it compare with other libraries now? How does what compare? No other library is making the optimizations we are - or even examining how to perform faster operations here. --John
[jQuery] Re: jquery.blockUI: Any way to preload images for the blockUI dialog?
You can use this preload plugin and run it as soon as possible: jQuery.preloadImages = function() { for(var i = 0; iarguments.length; i++) { jQuery(img).attr(src, arguments[i]); } } $.preloadImages(over.png, out.gif); $( function() { // do something when page is ready } ) On Apr 6, 8:14 am, miCRoSCoPiC^eaRthLinG [EMAIL PROTECTED] wrote: Hi, I am loading this animated .gif loader image into the blockUI dialog. When the dialog comes up, there's a lag of 2-3 seconds before the image appears.. this looks pretty unprofessional. So is there any way to pre-load these images so that they appear along with the message the moment the dialog pops-up? Thanks, m^e
[jQuery] Re: Return the checked items from checkboxes plugin
On Mar 3, 3:51 pm, owen [EMAIL PROTECTED] wrote: I wrote: I'm using thecheckboxesplugin (http://www.texotela.co.uk/code/jquery/checkboxes/) and I'd like to pass the id of each checkbox that gets checked to a function. I see that the plugin has an option to return the checked items: Return the checked items: $(#myform).checkCheckboxes(.top5, true); Do I need to construct it like this in order to access the returned object? checkall = $(#myform).checkCheckboxes(*, true); Don't I need to know the structure of the object in order to access information about it? Owen When you pass 'true' as the second parameter, you get a jQuery object consisting of all the checkboxes. So, to get what you want: var checked = []; $(#myform).checkCheckboxes(.top5, true).each( function() { checked[checked.length] = this.id; } ); checked is an array of id's. -- Sam
[jQuery] Re: BBC Site - jQuery
The beta test has been up for a while and looks like it uses Interface (http://interface.eyecon.ro/) for the interactivity. Not jQuery UI unfortunately (Interface is more established though and has probably had more testing). There is still some legacy code (for example they use Simon Willison's addLoadEvent function), so not completely moved over. I think it is only the home page that uses jQuery. Perhaps there are some of the editors who worked on it on this mailing list? -- Sam On Mar 3, 11:50 am, Dan Mitchell [EMAIL PROTECTED] wrote: Hi all, The new BBC website is using jQuery - a testament to how great jQuery is! Go team jQuery! http://www.bbc.co.uk Regards Dan
[jQuery] Re: What tool is used to minify the official jQuery distribution?
JSMin is the minifier that jQuery uses (the port to JavaScript by Franck Marcia). In SVN: http://dev.jquery.com/browser/trunk/jquery/build/js/jsmin.js On Feb 8, 11:17 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Collin, Thanks for the link, PHP Speedy looks interesting. I could potentially use it in a few hobby site scenarios, though I should state that this particular case involves ColdFusion as the server side scripting environment running on Windows with an IIS6 web server. These are far from ideal conditions IMO, but it's what I've got to work with! I've been using YUI Compressor to do some testing and it appears to strip trailing semicolons from .js files. Checking jQuery minified and various plugins minified, I found that there are in fact trailing semicolons in those scripts. They Yahoo minified scripts I'm using work fine when loaded on their own, but I've not yet tried to concatenate them all. I'll try that next to see the outcome. Anyone else have a line into the official minifier used for jQuery? Thanks, haylo On Feb 7, 3:36 pm, Collin Allen [EMAIL PROTECTED] wrote: This isn't the official tool (I'm not sure what is, maybe jsmin?), but you might find it helpful/inspiring: http://aciddrop.com/php-speedy/ On Feb 7, 12:44 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've been testing out various minifying strategies, such as Dean Edwards' packer, YUI Compressor, jsmin, etc. My goal is to concatenate all my required .js files and thenminifythem en masse. I've read of concerns about trailing semicolons, etc. and am curious what tool is used tominifythe official jQuery distribution. Please post if you have knowledge! Thanks, haylo
[jQuery] Re: new jQuery user needs help
You only need newsticker.pack.js in you head and have to add some code to make it load on statup, e.g. in head script type=text/javascript src=jquery-1.2.2.js/script script type=text/javascript src=jquery.newsticker.pack.js/ script script type=text/javascript $( function() { $(#newsticker).newsTicker(); }); /script On Jan 24, 6:10 am, visitorQ [EMAIL PROTECTED] wrote: well i tried posting some code but it didn't work for some reason and it's a lot of crap so i think the best way you could help is to go to this linkhttp://www.texotela.co.uk/code/jquery/newsticker/and test out the first example. see how you can get it to work on your own development environments. and when you do, let me know how you did it and why you think it's not working for me. like if there's something that is obviously advanced about this or not. anyway. i really really appreciate it guys.
[jQuery] Re: TexoTela select box manipulation modification
This should work: $.fn.moveOptions = function(to, which) { this.copyOptions(to, which); if(which == all) { this.find(option).remove().end(); } else { this.find([EMAIL PROTECTED]).remove().end(); } return this; } On Jan 16, 11:03 pm, codecowboy [EMAIL PROTECTED] wrote: Hi Guys, I am trying to add a function to theTexoTelaselect box manipulation plug-in (http://www.texotela.co.uk/code/jquery/select/). I am trying to add a function called moveOptions() that will function like a cut paste from one text box to another. There is already a function called copyOptions() that copies a selected value from one select box to another. I copied the code from copyOptions() to my new function moveOptions() to modify. I figure that the only change would be to remove the selected option from the 1st select box after adding it to the 2nd select box. The concept is simple but my code is yielded strange results. The functionality breaks down when you try to copy multiple options at once. I am relatively new to jquery so I'm hoping that it is something obvious. Any help would be greatly appreciated. Thank you in advance. You can test out the code here:http://www.digital-magic.biz/guy/cake_1_2_blog_tutorial/blog_wizard/f Here is my function, I commented out all the different things that I have done in an attempt to make it work: /** * Move options to another select (functions like cut and paste) * * @name moveOptions * @author Sam Collett (http://www.texotela.co.uk) * @type jQuery * @paramString to Element to move to * @paramString which (optional) Specifies which options should be copied - 'all' or 'selected'. Default is 'selected' * @example $(#myselect).moveOptions(#myselect2); // copy selected options from 'myselect' to 'myselect2' * @example $(#myselect).moveOptions(#myselect2,selected); // same as above * @example $(#myselect).moveOptions(#myselect2,all); // copy all options from 'myselect' to 'myselect2' * */ $.fn.moveOptions = function(to, which) { var w = which || selected; if($(to).size() == 0) return this; this.each( function() { if(this.nodeName.toLowerCase() != select) return this; // get options var o = this.options; // get number of options var oL = o.length; for(var i = 0; ioL; i++) { alert(o[i].value + -- + o[i].text + -- + o[i].selected); if(w == all || (w == selected o[i].selected)) { //alert(1 + o[i].text + o[i].value); //alert(o.toString()); $(to).addOption(o[i].value, o[i].text); $(this).removeOption(o[i].value); //$(this).remove(o[i].value); //this.remove(o[i].value); //alert(2 + o[i].text + o[i].value); } //$(this).removeOption(o[i].value, true); } } ); return this; };
[jQuery] Re: TexoTela select box manipulation modification
I think it may be because when you remove an option the total number of options is decreased, so you never get through all of them. Start at the last option and then go back, so instead of: for(var i = 0; ioL; i++) Maybe (untested): for(var i = oL; i0; i--) On Jan 17, 3:44 pm, codecowboy [EMAIL PROTECTED] wrote: Thank you very much. That worked. It would be great if you had the time to tell me what was wrong with my original code because JS is something that i am not so familiar with. On Jan 17, 7:25 am, Sam Collett [EMAIL PROTECTED] wrote: This should work: $.fn.moveOptions = function(to, which) { this.copyOptions(to, which); if(which == all) { this.find(option).remove().end(); } else { this.find([EMAIL PROTECTED]).remove().end(); } return this; } On Jan 16, 11:03 pm,codecowboy[EMAIL PROTECTED] wrote: Hi Guys, I am trying to add a function to theTexoTelaselect box manipulation plug-in (http://www.texotela.co.uk/code/jquery/select/). I am trying to add a function called moveOptions() that will function like a cut paste from one text box to another. There is already a function called copyOptions() that copies a selected value from one select box to another. I copied the code from copyOptions() to my new function moveOptions() to modify. I figure that the only change would be to remove the selected option from the 1st select box after adding it to the 2nd select box. The concept is simple but my code is yielded strange results. The functionality breaks down when you try to copy multiple options at once. I am relatively new to jquery so I'm hoping that it is something obvious. Any help would be greatly appreciated. Thank you in advance. You can test out the code here:http://www.digital-magic.biz/guy/cake_1_2_blog_tutorial/blog_wizard/f Here is my function, I commented out all the different things that I have done in an attempt to make it work: /** * Move options to another select (functions like cut and paste) * * @name moveOptions * @author Sam Collett (http://www.texotela.co.uk) * @type jQuery * @paramString to Element to move to * @paramString which (optional) Specifies which options should be copied - 'all' or 'selected'. Default is 'selected' * @example $(#myselect).moveOptions(#myselect2); // copy selected options from 'myselect' to 'myselect2' * @example $(#myselect).moveOptions(#myselect2,selected); // same as above * @example $(#myselect).moveOptions(#myselect2,all); // copy all options from 'myselect' to 'myselect2' * */ $.fn.moveOptions = function(to, which) { var w = which || selected; if($(to).size() == 0) return this; this.each( function() { if(this.nodeName.toLowerCase() != select) return this; // get options var o = this.options; // get number of options var oL = o.length; for(var i = 0; ioL; i++) { alert(o[i].value + -- + o[i].text + -- + o[i].selected); if(w == all || (w == selected o[i].selected)) { //alert(1 + o[i].text + o[i].value); //alert(o.toString()); $(to).addOption(o[i].value, o[i].text); $(this).removeOption(o[i].value); //$(this).remove(o[i].value); //this.remove(o[i].value); //alert(2 + o[i].text + o[i].value); } //$(this).removeOption(o[i].value, true); } } ); return this; };
[jQuery] Re: add changing URL string to address for AJAX a la Gmail 2
You may find the history plugin to be of use (not sure if there is a newer version as that page hasn't been updated for a while): http://stilbuero.de/jquery/history/index.html On Jan 8, 6:19 am, Scott Hulbert [EMAIL PROTECTED] wrote: Hi everyone, I'm working on a simple project and I'm going to use jQuery's .load function to switch between content pages so that the page does not have to unload and reload. I'm doing this because my page needs a flash music player on it and this allows for uninterrupted music. I'd like a way to do something similar to what Gmail does now. For example, when I click on a message the address in the address bar changes to: http://mail.google.com/mail/#inbox/11757de76c56c762; I just want something simple, like domainname.com/home.php?page=about...orsomething more similar to gmail, a la domain.com/home.php#about. This isn't necessary but it is nice for the user and could eventually be used with PHP to redirect a user to a linked page. Thanks to anyone with any insight on how this would be done. I have a decent knowledge of jQuery but my javascript is a bit weak. --Scott Hulbert
[jQuery] Re: Cross Browser Issues - Simple use of JQuery
On Nov 12, 4:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: To nest lists properly, I believe you want to put the ul you are toggling inside the li you are clicking Also, only li can be nested in ul or ol, so it would be invalid HTML (although browsers forgive that).
[jQuery] Re: JSS - New Plug-in
I noticed that you have added String.prototype.trim. jQuery actually has this already, e.g. jQuery.trim( foo ); An easy was to get better CSS support in browsers that are not up to it. Maybe in a future version, browsers that are capable will just be ignored? Also, maybe best to wrap it in a closure: (function($) { // plugin code here, use $ as much as you like })(jQuery); On Oct 7, 12:39 am, Andy Kent [EMAIL PROTECTED] wrote: Hi Guys, This is a plug-in that was thrown together in a few spare hours after chatting with some people at FOWA last week, I hadn't had much sleep at the time so it's still a bit rough round the edges. In a nutshell though it gives you full support for all jQuery selectors from within your CSS files in a totally unobtrusive mannor. This effectively means cross browser CSS3 support via JavaScript. You can find out more and grab it from: http://andykent.bingodisk.com/bingo/public/jss/ Any feedback, good or bad would be appreciated. Thanks, Andy.
[jQuery] Re: the jquery logo
jQuery Button Contest Winners: http://jquery.com/blog/2006/11/07/jquery-button-contest-winners/ Also, the post announcing the competition has logos in the comments. jQuery Button Contest: http://jquery.com/blog/2006/10/26/jquery-button-contest-many-prizes/ On 4 Oct, 07:38, Tane Piper [EMAIL PROTECTED] wrote: Also, check through the blog on http://jquery.com/blog - there is an old thread from last year where people submitted their own jQuery logo's for use of websites. Although there was a winner, you are free to choose whichever one you want to use. On 04/10/2007, Joel Birch [EMAIL PROTECTED] wrote: Whoops, bad link. Here it is: http://users.tpg.com.au/j_birch/plugins/superfish/img/jQuery-alpha-tr... -- Tane Piper Blog -http://digitalspaghetti.me.uk AJAX Pastebin -http://pastemonkey.org This email is: [ ] blogable [ x ] ask first [ ] private
[jQuery] Re: [Site Submission]: nbc.com
It's good that they are using it quite a bit. There are some site that use it, but only $(document).ready to call a function that manipulates the DOM the old fashioned way. On 4 Oct, 08:23, John Resig [EMAIL PROTECTED] wrote: Wow! Very awesome :-) It looks like they're getting a pretty good coverage of features, too. (DOM Manipulation, animations, events, etc.) --John On 10/4/07, Karl Swedberg [EMAIL PROTECTED] wrote: Looks like nbc.com is heavily into the jQuery love now, using 1.1.4.1 on their site. Looks like they're using Interface and Mike Alsup's Media plugin, and Klaus Hartl's cookie plugin. Also, pulling in some data with $.ajax, doing some accordion stuff, etc.. They could be using the This line appears in http://www.nbc.com/assets/js/global/nbc.com.jsright after all of the jQuery code: // Legacy crap - Pretty funny. Here's another file you might want to poke around in: http://www.nbc.com/assets/js/video/fun.js --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Catch a click event before the DOM is loaded
Wouldn't it be easier just to hide the button via CSS and then show it when the document is ready? Or disable the button (via html) then enable it again via script? On Oct 1, 12:38 pm, Remy Sharp [EMAIL PROTECTED] wrote: I've recently been working on a project where the page is complex enough that the DOM would not have loaded before the user had spotted our 'big red button' - and clicked away. As much as I hate to admit, this project wasn't going to support a non- JS version (due to the demographic), so I thought I'd share how we solved the problem of early clicks. I have a full write up here: http://remysharp.com/2007/10/01/catch-click-events-before-the-dom-is-... In short: add an explicit click handler on the link/s in question returning the value from the following function: code function earlyClickHandler() { var t = this; if (typeof $.isReady == 'boolean' $.isReady) { return true; } else if (!t.clicked){ t.clicked = true; // once DOM is loaded, fire this click handler $(function () { $(t).click(); }); } return false;} /code I'm an advocate for unobtrusive JavaScript, but sometimes you have to work with what you've got. I'd welcome any feedback. Cheers, Remy.
[jQuery] Re: Did I get *all* of the XPath plugin?
Can it also be changed to take advantage of some browsers XPath parsing abilities (that is how I thought it would have worked when 1.2 came out)? I know Firefox has native parsing (http:// developer.mozilla.org/en/docs/ Introduction_to_using_XPath_in_JavaScript) and so does Internet Explorer (via ActiveX(MSXML.DOMDocument)) - do Opera and Safari? On Sep 28, 4:17 pm, John Resig [EMAIL PROTECTED] wrote: Yes, that's it. We really don't support very much XPath, only a couple commands. That was a big reason why it was removed, we didn't have to resources or interest to flush it out into a full XPath representation. --John On 9/28/07, Danjojo [EMAIL PROTECTED] wrote: Is this all I need to add to my external .js library to fully include the Xpath plugin? /* * Simple XPath Compatibility Plugin for jQuery 1.1 * By John Resig * Dual licensed under MIT and GPL. */ (function(jQuery){ var find = jQuery.find; jQuery.find = function(selector, context){ // Convert the root / into a different context if ( !selector.indexOf(/) ) { context = context.documentElement; selector = selector.replace(/^\/\w*/, ); if ( !selector ) return [ context ]; } // Convert // to selector = selector.replace(/\/\//g, ); // Convert / to selector = selector.replace(/\//g, ); // Naively convert [elem] into :has(elem) selector = selector.replace(/\[([EMAIL PROTECTED])\]/g, function(m, selector){ return :has( + selector + ); }); // Naively convert /.. into a new set of expressions if ( selector.indexOf(..) = 0 ) { var parts = selector.split(/\.\.?/g); var cur = jQuery(parts[0], context); for ( var i = 1; i parts.length; i++ ) cur = cur.parent(parts[i]); return cur.get(); } return find(selector, context); }; })(jQuery);
[jQuery] Re: When will the API be updated for 1.2.1?
You use MediaWiki don't you? If so can't you convert the Wiki markup to Xml and go from there? e.g. http://www.mediawiki.org/wiki/Extension:Wiki2xml Much better than screen scraping. On Sep 27, 4:24 pm, Brandon Aaron [EMAIL PROTECTED] wrote: The documentation is going through some growing pains. Currently the only source of documentation for 1.2.x is on the wiki. I've been thinking about how we can take those docs and create an XML file like we had before ... currently the only idea I have is to screen scrape which if you look at the actual markup of the Wiki is a pain and doesn't scale well for inclusion of plugins, etc. I've made a little progress (still have a long way to go) with using Hpricot to at least get the core docs into XML. -- Brandon Aaron On 9/27/07, Andy Matthews [EMAIL PROTECTED] wrote: I use this: http://jquery.com/api/ all the time because it's the simplest, easiest, reference for jQuery methods and behaviours. But it still lists it's version as 1.1.2. Are there plans to update this reference? Alternately, I'd argue that there needs to be ONE single point of entry (on the jQuery site at least) for a straight up reference. I'm not talking about the fluffy examples found in the wiki area, but just a terse explanation of the method, it's parameters, and how to use it. * Andy Matthews *Senior ColdFusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED] www.dealerskins.com dealerskinslogo.bmp 6KDownload
[jQuery] Re: Focusfields
I can replicate the error: http://www.texotela.co.uk/code/jquery/focusfields/?jqver=1.2.1 I will see what is causing the problem. On Sep 25, 4:31 pm, Charles Sheehan-Miles [EMAIL PROTECTED] wrote: Hello all, I'm new to jquery, so forgive me if I'm asking questions which have been asked a thousand times. I've searched through the list archives and not had much luck with this one. I'm using the focusfields plugin, which I found here: http://www.texotela.co.uk/code/jquery/focusfields/ It works great on Firefox, Camino, etc., and the demo works fine on IE. But in my test setup, I get this error: 'this.parentNode.borderCss.off' is null or not an object Error comes up as soon as the page loads. I'm using jQuery 1.2 on my server, which is the one difference I found from the demo page (which seems to be calling jquery-1.1.2.pack.js). If this possibly a version difference, and the newer version doesn't deal as well with IE? Hope someone has some ideas, Charles
[jQuery] Re: Focusfields
Found out the cause, but not sure how to work around it at the moment: http://www.texotela.co.uk/wrapexpandos.php On Sep 26, 1:47 pm, Sam Collett [EMAIL PROTECTED] wrote: I can replicate the error:http://www.texotela.co.uk/code/jquery/focusfields/?jqver=1.2.1 I will see what is causing the problem. On Sep 25, 4:31 pm, Charles Sheehan-Miles [EMAIL PROTECTED] wrote: Hello all, I'm new to jquery, so forgive me if I'm asking questions which have been asked a thousand times. I've searched through the list archives and not had much luck with this one. I'm using the focusfields plugin, which I found here: http://www.texotela.co.uk/code/jquery/focusfields/ It works great on Firefox, Camino, etc., and the demo works fine on IE. But in my test setup, I get this error: 'this.parentNode.borderCss.off' is null or not an object Error comes up as soon as the page loads. I'm using jQuery 1.2 on my server, which is the one difference I found from the demo page (which seems to be calling jquery-1.1.2.pack.js). If this possibly a version difference, and the newer version doesn't deal as well with IE? Hope someone has some ideas, Charles
[jQuery] Re: OT: Google autofill(or any others) and form events
I don't know if you can check if autofill has changed a form field. What may work is using a setTimeout (to give the autofiller chance to run) and then reset the background colour: setTimeout( function() { $(#myfield).css(background-color, )}, 1000); I have not tried this, so am not 100% sure if it will work. For a designer, disabling autofillers may be desirable, but they are a useful feature of various toolbars. The other way would be to use non-standard field names: input name=__forename__ type=text On Sep 24, 3:46 pm, Eridius [EMAIL PROTECTED] wrote: I have been trying to think of a way to track auto fill type stuff. I am not sure if this is possible, but is there a way to track if the text() of a certain object has changed and then trigger an even ti it has. Eridius wrote: I am doing some validation on a form using live validation. One issue that someone brought up is what about autofillers? is thier a way to trigger the event with an autofiller or disable the use of auto filler on that form element? it is a short form so i don't care are disabling that. -- View this message in context:http://www.nabble.com/OT%3A-Google-autofill%28or-any-others%29-and-fo... Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: jQuery plugins repo is a major traffic generator
I find that's true with my site as well. 30% comes from the jQuery site. 36% is from Google, but mostly jQuery related searches. On Sep 18, 11:10 pm, Stephan Beal [EMAIL PROTECTED] wrote: Hi, all! The past couple of days i've been looking through some web logs and found some really unexpected things... a) Though jQuery-related stuff is only a small part of my website, the vast majority of the recent traffic targets my jQuery plugins pages. (This is not to imply that my plugins are particularly popular (they're not - they're all small/niche stuff).) b) The jQuery.com plugins repo is the most prolific referrer to my site. c) 3 of the top 5 search terms which bring people to the site (via google) are people searching for a jQuery color picker. Another one of those top 5 is someone looking for a color picker in javascript (not explicitly jQuery). My point is: If you write plugins, add them to the jQuery plugins repository. There are lots of good reasons to do so, but one reason which is probably under-considered is that doing so will drive traffic more traffic to your site. Case in point:http://wanderinghorse.net/computing/javascript/jquery/ :)
[jQuery] Browser Crash on SlideToggle (IE)
I have a strange situation where the browser crashes when a SlideToggle animation is applied. It happens with Internet Explorer 6 and 7. What makes it particularly odd is that it only happens for part of the site. Steps to reproduce: Go to http://www.nelctp.nhs.uk Click on Help in the bar at the top Then click on SiteMap The browser then becomes unresponsive. If you click on SiteMap on any other pages (as long as they are not under /help/) this problem does not occur and it slides down as intended. Anyone able to replicate this or know why it is happening?
[jQuery] Re: JSPacker for .NET
That's something I'd be interested in using. All the articles I've read about GZIP compression have been using PHP and never found anything that used C#. Does it also contain JSMin compression as an option? Also, if you made changes to Deans .NET packer perhaps you could send him the changes? On Sep 18, 2:08 am, Jeffrey Kretz [EMAIL PROTECTED] wrote: I've spend the last few days building a .NET implementation of a gzip packer. It accepts an argument like either of these two: script type=text/javascript src=JSPacker.ashx?F=~/script.js/script script type=text/javascript src=JSPacker.ashx?F=AssemblyName:Resources.jquery.js/script It will also accept a semicolon-delimited list of files and will stream them back as a single file. I took Dean Edwards packer, updated the .NET implementation, and used the built-in gzip library to perform the compression. The basic idea is that you can have fully readable, uncompressed javascript as a resource in your assembly or saved in a directory on your website. When you run the website in debug mode (Cassini server) the files are not minified. In a production environment, the source files are minified, gzipped and cached on the server. I did some testing and it appears to be working very well for me, although the jQuery source file was only compressed down to 16.5kb (instead of 14.5kb). This may be due to the MS implementation of Gzip, but I'm not sure. I can't host this for download on my company's website for various reasons, but I'd happily send the source code and binaries (strong-named for use in the GAC) to anyone who wants it. JK
[jQuery] Re: John's Pager - best plugin no one uses?
eq is in 1.2.1, but gt and lt are not. On Sep 18, 5:14 am, Joan Piedra [EMAIL PROTECTED] wrote: On 9/17/07, astik [EMAIL PROTECTED] wrote: With the new version of jQuery out (1.2), some specific code is no longer working ... The lt and gt method are now deprecated ... Hi Astik, they are back in 1.2.1 -- Joan Piedra || Frontend web developerhttp://www.justaquit.com/ || http://www.joanpiedra.com/
[jQuery] Re: Google Code
Looks like it is being used to show the Google Code blog posts and featured projects. Maybe they will use some of the more advanced features someday. On Sep 18, 3:54 pm, Rey Bango [EMAIL PROTECTED] wrote: The next time you hear someone say that jQuery isn't a mature framework, be sure to point them to this URL: http://code.google.com/ The way I see it is if Google feels confident enough to use jQuery, then that speaks volumes and the naysayers can take a hike! Rey...
[jQuery] Re: Google Code
Google Web Toolkit is for Java developers (run server side), so it can't be used for those who may use ASP.NET, PHP, CFML etc On Sep 18, 5:25 pm, Anjanesh [EMAIL PROTECTED] wrote: Wow ! I really thought prototypejs being the more popular one !http://www.prototypejs.org/real-world Odd, I thought Google Web Toolkit (http://code.google.com/webtoolkit/) was another JavaScript framework.
[jQuery] Re: Thanks for bringing back eq() in 1.2.1
On Sep 17, 1:06 pm, Stephan Beal [EMAIL PROTECTED] wrote: i think the main reason lt/gt were removed was because you can do the same thing with slice(). John Resig said in a post a week or so ago that they were also removed because they did only one thing, and didn't do it terribly well (or something to that effect). Fair enough, but then i would prefer that x.lt(n) be kept and implemented in terms of $( :lt(n),x), or vice versa. :) I think it would be better if it worked a bit like how the format plugin does it (http://bassistance.de/jquery-plugins/jquery-plugin- format/) or even better, the .NET way: var x = 2; var y = span; $(:filter({1}):gt({0}), x, y); // filter(span):gt(2)
[jQuery] Re: BUG ? cannot detect the id with :
You have to escape with \\ $(#this\\:is\\:only\\:example); On Sep 13, 9:42 am, Adwin Wijaya [EMAIL PROTECTED] wrote: Hi :) I am glad you are reache version 1.2 :) that's awesome .. but I would like to report the bug, it seems the jquery 1.2 (and before) still couldnt detect the id with : for example div id=this:is:only:example /div this code usually generated by those who using netbeans + visual webpack. they generated silly id like that .. but it works very well using prototype :) adwin
[jQuery] Re: newbie: how can I get the # of options in a SELECT element?
That gets all options in all selects, this would be better: $('#mySelectElement option').length On Sep 12, 1:14 pm, David Duymelinck [EMAIL PROTECTED] wrote: $('select option').length should do it. -- david Ojas schreef: Using jQuery, how can I get the following value? document.myForm.mySelectElement.options.length -- David Duymelinck [EMAIL PROTECTED]
[jQuery] Re: position in selector
var $a = $('a').click(function() { console.log('anchor' + $a.index(this) +' in page'); }); On Sep 12, 7:58 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have the following code $('a').click(function() { console.log('anchor'+ pos+' in page); }); I'd like to be able to get the matched position number (pos) of each element found, so if my page has 5 anchor tags, if i click on the first a element in the page, its pos would be 1 (or 0), etc.
[jQuery] Re: Corner Plugin affects layout
I tried to reproduce it in a test page, but was unable to. I solved it by using .css(position, ) There is a demo of the issue at http://www.nelctp.nhs.uk/default2.aspx And without corner plugin: http://www.nelctp.nhs.uk/default2.aspx?nocorner Which actually illustrates some problems with the pngfix plugin: http://khurshid.com/jquery/iepnghack/ On Sep 10, 11:37 pm, Mike Alsup [EMAIL PROTECTED] wrote: Sam, Did you get this solved? I couldn't reproduce the error (IE7), but it sounds like a classic hasLayout problem. Mike On 9/10/07, Sam Collett [EMAIL PROTECTED] wrote: Using canvas instead of nested div's for the corner didn't help with the layout (although it looks slightly better). The problem is caused by the 'position: relative' added to the element with the corner applied to it. On Sep 10, 2:28 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: use this plugin:http://meerbox.nl/?page_id=4 works fine and it's pretty nice ;)
[jQuery] Re: Corner Plugin affects layout
I did manage to fix it, but set up a page showing the problems I have been having: With corner: http://www.nelctp.nhs.uk/default2.aspx Without: http://www.nelctp.nhs.uk/default2.aspx?nocorner The corner is applied to the two boxes in the middle (only very subtle corners). On Sep 10, 11:58 pm, Christopher Jordan [EMAIL PROTECTED] wrote: Sam, I visited both links in your post (using IE6) and I can't see the problem? Also, I don't see anything on either page that looks like the corner plug-in has been applied. Hmmm... did you fix things already? :o/ Chris On 9/10/07, weepy [EMAIL PROTECTED] wrote: that's an awesome plugin On Sep 10, 3:59 pm, Sam Collett [EMAIL PROTECTED] wrote: Using canvas instead of nested div's for the corner didn't help with the layout (although it looks slightly better). The problem is caused by the 'position: relative' added to the element with the corner applied to it. On Sep 10, 2:28 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ugin use this plugin:http://meerbox.nl/?page_id=4 works fine and it's pretty nice ;) --http://cjordan.us
[jQuery] Re: Odd back-button behavior on 1.2 documentation pages
If ajax was used, you could load into a div and so not add to the history. Although you may have to have the external file with head and body tags, e.g. script type=text/javascript/script div.../div On Sep 11, 9:24 pm, John Resig [EMAIL PROTECTED] wrote: The loading part isn't the issue - the issue is in running these demos in a contained area that doesn't interfere with the rest of the page (or the rest of the page interfere with it). --John On 9/11/07, Sam Collett [EMAIL PROTECTED] wrote: Use Ajax and load into a div? On Sep 11, 4:37 pm, John Resig [EMAIL PROTECTED] wrote: We load the demos in an iframe, that must push it into the history. Anyone have any thoughts? --John On 9/11/07, Scott Sauyet [EMAIL PROTECTED] wrote: I've noticed something odd on the documentation pages. The back button is acting as though I've made multiple visits to the same page. For instance, if in a new browser window I visit http://docs.jquery.com/Release:jQuery_1.2/Effects I see seven entries in the Firefox's back-button drop-down, all pointing to the current page. I see the same behavior in IE6, IE7, and Op9. Safari3/win doesn't do this. The number of entries in the history varies; and I think it's related to the number of demos on the page. Does it perhaps have to do with the Tabs? Can anyone else at least confirm that I'm not simply crazy? -- Scott
[jQuery] Re: Learning JQuery book typo: plugins repo URL is 404
Although, perhaps a better idea would to have a redirect in place as I am sure there are many other sites that refer to that folder? On Sep 12, 1:34 am, Karl Swedberg [EMAIL PROTECTED] wrote: Thanks a lot, Stephan, for the note. I will send this on to the publisher. In the future, you can report errata directly at Packt's web site:http://www.packtpub.com/support/book/jQuery Also, I'm keeping an informal list of errata on the book's companion site at:http://book.learningjquery.com/forums/ Cheers, --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Sep 11, 2007, at 6:02 PM, Stephan Beal wrote: Hiya! i'm not sure where to post bugs related to the Learning jQuery book, so i'll drop it here: Page 309 says: The jquery.com Plugin Repository athttp://jquery.com/Plugins/ is a great place to start when looking for documentation. That URL is a 404, though - plugins should be lower-case. Perhaps the webmaster can adjust for that, rather than waiting on the next edition of the book. :)
[jQuery] Corner Plugin affects layout
When I apply the corner plugin to an element on the page, the layout is affected when I hover over a link with padding. This only seems to occur in Internet Explorer (IE 6 and 7), and I am unable to find out the cause. To replicate, go to http://www.nelctp.nhs.uk Resize the browser window (making it bigger illustrates the problem better), the boxes in the middle should move (to stay in the centre), but they don't. Then mouse over one of the links on the right. The right box moves to the correct position when this happens. I know it is the corner plugin, as a test without it applied works: http://www.nelctp.nhs.uk/?nocorner
[jQuery] Re: Another site using jQuery...
It uses something else that does not use jQuery: http://www.barelyfitz.com/projects/tabber/ Something similar can be done with jQuery. e.g. http://www.texotela.co.uk/code/jquery/headertabs/ On Sep 10, 1:58 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Rick Faircloth wrote: Oops! Sorry about that, Klaus! Rick Rick, no need to apologize of course! Just wanted to give a hint for how to detect the tabs plugin :-) --Klaus
[jQuery] Re: Corner Plugin affects layout
Using canvas instead of nested div's for the corner didn't help with the layout (although it looks slightly better). The problem is caused by the 'position: relative' added to the element with the corner applied to it. On Sep 10, 2:28 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: use this plugin:http://meerbox.nl/?page_id=4 works fine and it's pretty nice ;)
[jQuery] Re: validation plugin : conflict with formsess because of {
You could try adding this in $(document).ready, before calling the validate plugin: $.meta.cre = /(\[.*\])/; $(#foo).validate(); Although that is not documented in the meta data plugin (maybe there should be an option in it to do that). On Aug 28, 9:05 am, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Hi I'm having an issue with the validation plugin. It conflicts with a smarty-based php class named formsess. It does not allow signs such as { in form tags. Sounds like hell to go modify formsess, so I hope to find a way to change that in the validation plugin. Could it be possible to replace class={required: true} with class=[required: true] ? thanks -Olivier
[jQuery] Re: Why isn't there top() and left() methods in the dimension plugin ?
On Aug 28, 1:59 pm, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Wow your too fast guys. It seems that I was using offset() the wrong way. $left = element.offset().left; $top = element.offset().top; The only problem with that is you are calling offset twice (which may impact performance). I would do: $offset = element.offset(); $left = $offset.left; $top = $offset.top;
[jQuery] Re: Recursive setting of names in jquery
The way I would do this is get all inputs with a name beginning with 'total' then use .each: // save jQuery object for later use $totals = $([EMAIL PROTECTED]); $totals.each( function() { // get letter var letter = this.name.substr(5); if(letter == A) this.value = Total A; }); On Aug 28, 5:00 am, Brett [EMAIL PROTECTED] wrote: Hello there, I've been loving jQuery so far - so efficient, and a great piece of code to work with. I was wondering if it is possible to use jQuery in a loop where I need to set a row of values in. For example if there was a set of input boxes named totalA - totalE. To change the first, I would use: $([EMAIL PROTECTED]'totalA']).val(the value I want to put on this form); But is there a way I can make @name a variable, or a combination of strings? @name='total' + currentLetter Does not work like I thought it would have.. I think there is something fundamentally wrong that I'm doing...
[jQuery] Re: validation plugin : conflict with formsess because of {
How about: $.meta.cre = /((?!\[)(.*)(?=\]))/; This will fail if you use class=foo [required: true] but should be fine with class=[required: true] foo For it to work like it does with {} (class names before and after are ignored), the meta data plugin would probably be have to be modified. On Aug 28, 1:25 pm, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Thanks for your answers. Emil you are right at saying that it is not a jquery issue. Its even more a formsess issue than a smarty issue, and thats why your solution wont work.Because of the formsess filters it produces something like: ##FS_SMARTY_LDELIM##ldelim##FS_SMARTY_RDELIM##required: true##FS_SMARTY_LDELIM##rdelim##FS_SMARTY_RDELIM## So I'm looking more for a jquery solution. Sam your solution goes in the direction I'm looking for, but it produces an error: I tried with class=[required: true] and added $.meta.cre = /(\[.*\])/; in the jQuery(document).ready( Firebug says : invalid property id https://xxx.nondisclosabledomainname.com/subscription_new/js/jquery.m... Line 98 in green: data = {[required: true]} -Olivier On 8/28/07, Sam Collett [EMAIL PROTECTED] wrote: You could try adding this in $(document).ready, before calling the validate plugin: $.meta.cre = /(\[.*\])/; $(#foo).validate(); Although that is not documented in the meta data plugin (maybe there should be an option in it to do that). On Aug 28, 9:05 am, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Hi I'm having an issue with the validation plugin. It conflicts with a smarty-based php class named formsess. It does not allow signs such as { in form tags. Sounds like hell to go modify formsess, so I hope to find a way to change that in the validation plugin. Could it be possible to replace class={required: true} with class=[required: true] ? thanks -Olivier
[jQuery] Re: jQuery 1.1.4: Faster, More Tests, Ready for 1.2
You can still have slide by doing a plugin: $.fn.slide = function(dir) { if(!dir || dir == leftright) this.animate({width:'toggle'}, slow); else if(dir == updown) this.animate({height:'toggle'}, slow); } $(#foo).slide(leftright); $(#bar).slide(updown); Infact maybe slideUp, slideDown and slideToggle should be deprecated in favour of a .slide method (something for 1.2)? $(#foo).slide(width, toggle, slow); $(#foo2).slide(width, show, slow); $(#bar).slide(height, toggle, slow); $(#bar2).slide(height, show, slow); You can probably use .animate() for something like this, but shortcuts can be far better (especially if they are used a lot) - slightly more jQuery code, but less overall code. On Aug 24, 4:38 pm, Michael Stuhr [EMAIL PROTECTED] wrote: Andy Matthews schrieb: He might have misread the slice() function? that's a 2.0 feature (or better shall be) ... micha
[jQuery] Re: jQuery 1.1.4: Faster, More Tests, Ready for 1.2
On Aug 24, 8:31 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Bernd Matzner wrote: Thanks to everyone on the dev team for the new release! @Klaus: are you planning to update your tabs plugin to the new release? It uses eq(), which I understand are deprecated now. I'd rather work on UI Tabs aka Tabs 3 at the moment... :-) But ok, I'll fix that, I only need to figure out a way to support both 1.1.4 and less than 1.1.4 versions. --Klaus You could always use .filter(:eq(0)), which should make it 1.2 compatible as well.
[jQuery] Re: Comparison of different compressed jQuery Versions with GZip
Perhaps it should be part of the build process? So you can get packed, min'd and YUI'd versions of jQuery. On Aug 23, 12:43 pm, Tane Piper [EMAIL PROTECTED] wrote: Julien Lecomte has just released 1.1 of his YUI Compressor. As a test, he decided to use jQuery with GZip and came up with some interesting results compared to packer! http://www.julienlecomte.net/blog/2007/08/21/gzip-your-minified-javas... -- Tane Piperhttp://digitalspaghetti.me.uk This email is: [ x ] blogable [ ] ask first [ ] private
[jQuery] Loading remote JavaScript
Is there an easy way to get a remote script and run code when it has loaded as well as check the content type? $.getScript only works with those scripts on the same server. The problem I have is when using Google Maps I get often the sorry CAPTCHA page (the one you get if too many requests are made) instead of the JavaScript. This results in the rest of the JavaScript (not just the map) on the page not working. What I want to do is show that page (preferably in a Thickbox) when it happens so that the map will still work. The IP address is a common one (which is probably why the page is loaded) as it is used on a large WAN (NHS infact). I have asked on the Google Maps Help Group (July 31), but no one replied (even after replying to my own post over a week later. So I want to find out how to work around the problem. I have also tried having a proxy page at the server using ASP.NET and even then it doesn't work (only part of the script is loaded) which is a WebHandler: %@ WebHandler Language=C# Class=GoogleMaps % using System; using System.Web; using System.Text; using System.IO; using System.Net; public class GoogleMaps : IHttpHandler { public void ProcessRequest (HttpContext ctx) { ctx.Response.ContentType = text/javascript; ctx.Response.Write(GetRemoteScript(ctx, http://maps.google.com/maps? file=apiv=2key=GoogleMapsAPIKey)); ctx.Response.End(); } public bool IsReusable { get { return false; } } private string GetRemoteScript(HttpContext ctx, string url) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Referer = http://www.mywebsite.nhs.uk;; request.ContentType = text/javascript; try { // get the response HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // set the content length int contentLength = (int)response.ContentLength; // get the stream Stream responseStream = response.GetResponseStream(); // Pipes the stream to a higher level stream reader with the required encoding format. StreamReader readStream = new StreamReader(responseStream, ctx.Response.ContentEncoding); // create a char array char[] data = new char[contentLength]; // load from the stream into the char array readStream.Read(data, 0, contentLength); // return the data as a string return new String(data); } catch(Exception ex) { return string.Empty; } return string.Empty; } }
[jQuery] Re: Loading remote JavaScript
On Aug 21, 1:15 pm, Christof Donat [EMAIL PROTECTED] wrote: Hi, Is there an easy way to get a remote script and run code when it has loaded as well as check the content type? $.getScript only works with those scripts on the same server. You can use $('script src=http://example.com/myscript.js; type=text/javascript'). appendTo('head'); It should work in most cases, but there are Safari Versions which don't interpret scripts loaded that way. Christof I'm aware of that method, but I want a callback to find out what content type was loaded, display it if text/html or execute it if text/ javascript. Although the bit I am not sure of is how to execute the script after the user has passed the CAPTCHA test (especially since it is on a separate domain). Having a proxy on the server is the closest I can get, but I don't know why the whole script is not being retrieved.
[jQuery] Re: Loading remote JavaScript
On Aug 21, 2:19 pm, Christof Donat [EMAIL PROTECTED] wrote: Hi, I'm aware of that method, but I want a callback to find out what content type was loaded, display it if text/html or execute it if text/ javascript. $('script src=http://example.com/myscript.js; type=text/javascript'). appendTo('head'); $('script type=text/javascriptcallMyCallback/script'). appendTo('head'); Since the second tag will be inserted after the first, it will be executed after the first script is loaded and executed. Well, you don't get the content Type, but you can check for the existance of variables or functions that should be in the script. That at least tells you if the script has been loaded successfully as javascript. Christof The content returned from Google is in HTML format when it thinks someone is abusing their system with too many requests. As a result, the browser tries to execute the HTML as JavaScript, but as it is HTML instead there is a runtime error (thus preventing any further scripts from running). Unfortunately, this is not that easy to duplicate (unless you happen to be on the NHS network or some other large WAN) - at this very moment it is working, but I never know when it is going to fall over again. I don't know if the issue is localised or WAN-wide. There is an NHS site that uses Google Maps already: http://www.qof.ic.nhs.uk (not powered by jQuery though) and the main NHS.UK site uses Virtual Earth, but there are no plugins for working with that.
[jQuery] Re: ASP.NET IDs
On Aug 19, 6:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thank you all very much for the replies. They came in very useful! One quick question for Sam, though. You said you don't use gridviews, etc... what do you do then? Manually write the tables? I use a repeater and create a table, list, etc. That way I get it to display exactly how I want, with the markup I want to send to the end user. Much easier to style via CSS. I don't like how ASP.NET embeds CSS within the HTML. So something like this: asp:Repeater ID=MyCategoriesRepeater DataSource='%# MyCategories.DefaultView %' OnItemCommand=CategoryMaintenance runat=server HeaderTemplate ul class=categories /HeaderTemplate ItemTemplateliasp:TextBox ID=EditCategoryName Text='%# DataBinder.Eval(Container.DataItem, CategoryName) %' runat=server / asp:Button ID=EditCategoryButton runat=server Text=Save Category CommandName=Edit CommandArgument='%# DataBinder.Eval(Container.DataItem,CategoryID) %' / /li/ItemTemplate FooterTemplate/ul Add Category: asp:TextBox ID=NewCategoryName runat=server / asp:Button ID=NewCategoryButton runat=server Text=Add CommandName=Add / /FooterTemplate /asp:Repeater C# protected void CategoryMaintenance(object sender, RepeaterCommandEventArgs e) { switch (e.CommandName.ToString()) { case Add: string categoryname = ((TextBox)e.Item.FindControl(NewCategoryName)).Text; ... break; case Edit: int categoryid = int.Parse(e.CommandArgument.ToString()); string categoryname = ((TextBox)e.Item.FindControl(NewCategoryName)).Text; ... break; default: break; } } I then also use 'CategoryMaintenance' for other repeaters (like a nested one of sub categories). If I want to show more information, then I can easily convert it to a table.
[jQuery] Re: ASP.NET IDs
I use $([EMAIL PROTECTED]]) to get any input elements whose id ends with MyID (i.e. whatever you set in your ASPX page). Either that, or use a class instead. As for the 2nd question, I don't use anything other than the basic controls (repeater, dropdownlist etc - DataGrid's and GridViews I don't use) as it helps keep the HTML clean. It also means that any code I write will be pretty portable (i.e. very little modification needed to get it to work with PHP, JSP, CFML etc). On Aug 18, 9:29 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have two small questions, if anybody can help: 1. This was recently published concerning .NET: if you have an element that has runat=server attribute you cannot call it directly as #loginForm because asp.net rewrites the id to something different just doa view source on your aspx page and you will see the renamed form cleintid I was wondering how to probably implement jQuery with an ASP.NET control considering this problem. Or do we simply need to write out: ctl00_ContentPlaceHolder1_btnConfirm to access the btnConfirm button? 2) I'm also using AJAX update panel to update a gridview. Everything is working great. However, once I update the gridview and it's refreshed in AJAX, my jQuery no longer works, even though the code is there. Has anybody had any experience with this? Thanks for the help!
[jQuery] Re: Creating DOM elements on the fly
There are also a few others: http://jquery.com/plugins/project/FlyDOM Easy DOM creation (which technically does not require jQuery, just the presence of $ in the global namespace): http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype jquery-dom.js http://www.pinkblack.org/itblog/?page_id=22 jQDOM - a bit different to the others above (does not use JSON), more like the one by the OP Anurag (but with more features) http://www.alterform.com/resources/jqdom On Aug 17, 9:40 am, Byron [EMAIL PROTECTED] wrote: I guess this is probably just a bit late (and will be even later due google not posting my replies until after 24-48 hours ) but if your interested i wrote a plugin for creating dom elements from json templates have a look at it here :http://jquery.com/plugins/project/appendDom --Byron
[jQuery] Re: tablesorter 2.0 released
A great plugin that is now even better. You have put a lot of time into this it seems and it has come on a long way since the first table sorter release. You managed to get a good url for it as well.
[jQuery] Re: Partial Accordion Possible?
I have set up a test page: http://www.texotela.co.uk/accordiontest.php If I click several times on each heading, it freezes the browse (be it Firefox or IE). On Aug 10, 3:09 pm, Sean Catchpole [EMAIL PROTECTED] wrote: Hi Sam, With your html I was able to get this to work: $('#menu').Accordion({ header: 'li strong' }); ~Sean
[jQuery] Re: Partial Accordion Possible?
That doesn't collapse anything initially. If you click on 'Heading 2' or 'Heading 3' it actually collapses 'No sub items here' and 'Or here' (which should always show). On Aug 10, 4:20 pm, Sean Catchpole [EMAIL PROTECTED] wrote: On 8/10/07, Sam Collett [EMAIL PROTECTED] wrote: http://www.texotela.co.uk/accordiontest.php You could try this: $(#menu).Accordion({header:'li.haschildren[strong]'}); ~Sean
[jQuery] Re: Before automatically closes tags...?
Any chance that this will be added to the plugins page and SVN? It's a useful plugin that many may miss otherwise. On Aug 2, 6:56 pm, John Resig [EMAIL PROTECTED] wrote: I just made a quick tweak to .nextUntil() so that it can take a comma-separated list of items. I updated the demo to reflect this as well, for example: $(h2).each(function(){ $(this).nextUntil(h1, h2).wrapAll(div class='note'/div); }); --John On 8/2/07, DaveG [EMAIL PROTECTED] wrote: On Thu, 02 Aug 2007 15:55:20 -, Sam Collett [EMAIL PROTECTED] wrote: There is a plugin called nextUntil that you may be able to use. An example is available at http://dev.jquery.com/~john/jquery/test/nextuntil.html I hadn't seen that before. It's close, but not quite what I'm looking for, as I need to be able to specify a list of next elements: nextUnitl (h1,h2,h3...). I think amending the function to do that would be considerable work. What I'd really like is a way to insert dom elements without automatic closure taking place. I checked out jQ and didn't see a flag in the code; although to be honest I'm not sure I fully understood what's going on in there ;) ~ ~ Dave
[jQuery] Re: What does === equate to?
I don't think many actually use !== (and when you would want to use it) and many sites that show usage of operators don't cover !== (but do have ===). 3 != '3' false 3 !== '3'true 3 == '3' true 3 === '3'false On Aug 1, 9:33 pm, Michael Geary [EMAIL PROTECTED] wrote: I...cannot figure how what the heck === is. I see that Jake answered your question, but just for next time... You may have tried a Google search for javascript === and been disappointed to find it returned no useful results (because Google seems to ignore the === in the search). The key thing to know is that ===, like most special symbols in JavaScript such as + and -, is an operator. Now you can do a more productive Google search: http://www.google.com/search?q=javascript+operators This will help when you run into !== and wonder what the heck *that* one is. :-) -Mike
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
Some simple plugins that may help. (function($) { $.fn.moveRowAfter = function(index, afterIndex) { this.find(tr).eq(index).insertAfter(this.find(tr).eq(afterIndex)); return this; }; $.fn.moveRowBefore = function(index, beforeIndex) { this.find(tr).eq(index).insertBefore(this.find(tr).eq(beforeIndex)); return this; }; })(jQuery); Usage: // move first row after fourth row (won't do anything if there are less than 4 rows in the table) $(table tbody).moveRowAfter(0, 3); On Jul 30, 10:16 pm, Mike Miller [EMAIL PROTECTED] wrote: Haven't been able to find any documentation so far that talks about how to move rows around with jquery. Don't really need to sort the whole table...rather I want to move one row to another position. Can this be done?
[jQuery] Re: How to get font size in pixels?
On Aug 1, 11:13 pm, Luke Lutman [EMAIL PROTECTED] wrote: I've run into this before, and came up with pretty much the same solution as Klaus: http://jquery.lukelutman.com/plugins/px/jquery.px.js which you can call like so: $('#example').px('font-size'); One known bug is that it won't work for elements that don't accept content, like img / or input /. Cheers, Luke Another problem is that it wouldn't work if you use % for font size (which is true in my case). Getting the height may be a good option (although that also includes padding).
[jQuery] Re: Good Javascript editor or IDE?
I use Programmer's Notepad 2 (http://www.pnotepad.org/) and have even created some jQuery text clips (amongst others - http://www.texotela.co.uk/pn2/textclips/) for it. Although, as I am familiar with the jQuery API and have Visual Studio I don't use the clips much. It's not a full-blown IDE like Aptana or Visual Studio, but still a decent editor (as it does have a lot of features and loads quickly). On Aug 1, 7:00 pm, Matt Penner [EMAIL PROTECTED] wrote: I've just started developing with jQuery in the last month. I usually use VS 2005 or Notepad++ for my JavaScript. It's features are pretty much nil as far as intellisense goes. Mainly all they do is syntax highlighting and formatting. What recommendations on JavaScript editors or IDEs does anyone have? Is there something sophisticated enough that can have intellisense with jQuery or my own objects in external js files? Thanks, Matt
[jQuery] Re: How to get font size in pixels?
On Aug 1, 3:42 pm, george.gsgd [EMAIL PROTECTED] wrote: Perhaps think around the problem. Can you get the height of the element? That'd be in pixels regardless. Or maybe use sIFR instead? sIFR was used, but now a server-side method generates the image (i.e. so Flash isn't required and the amount the user has to download is less, plus the page is faster).
[jQuery] Re: Before automatically closes tags...?
There is a plugin called nextUntil that you may be able to use. An example is available at http://dev.jquery.com/~john/jquery/test/nextuntil.html Although I'm surprised it isn't in SVN or on the plugins page (perhaps there are bugs?). On Aug 2, 3:48 pm, DaveG [EMAIL PROTECTED] wrote: I'm trying to enclose sections of the dom with a DIV tag. Basically I want all elements between headings (and including the top-most heading) enclosed in a DIV. My approach is to scan through the DOM, find a header tag, insert an opening DIV tag, continue scanning until I hit the next header, close the prior div, and open a new div tag. Thus: h2heading 2a\h2 ...html tags... h3heading 3a\h3 ...html tags... h2heading 2b\h2 ...html tags... Becomes (indent added for clarity only): div h2heading 2a\h2 ...html tags... \div div h3heading 3a\h3 ...html tags... /div div h2heading 2b\h2 ...html tags... /div I'm using .before to add the starting div tag, but it looks like .before automatically closes open tags. I don't see any mention of this in the docs. How would I go about adding an open ended tag to the DOM? Alternately, is there a way of identifying each section between headers so I can .wrap with a div? Here's the code snippet: var open = false; $('#text').children().each(function(i) { if( this.nodeName.match(/^H\d+$/) ) { if (open) { $(this).before('/div'); } $(this).before('div class=xxx'); open = true; } });
[jQuery] How to get font size in pixels?
When I use $(h1).css(font-size) it differs across browsers. Firefox returns it the way I want (in pixels), but Internet Explorer it returns it as returned from the stylesheet (so it could be % or em). How can I then convert the %/em value into pixels? I am doing image replacement (byt getting the text and passing it onto a server side image generation web handler) and as a result the font size is 76px rather than 24px (due to using var fontSize = parseInt($this.css(font-size)))
[jQuery] Re: Safari 1.3.2 click event not returning false
While in an ideal world, people would update their browser, sometimes it is not a viable choice (does Safari 2 even work on OSX 10.3.x?) and may even alienate users (imagine how much easier it would be if all IE6 users went to IE7 or Firefox?). Rather than 'return false' perhaps e.preventDefault will work (I don't have any version of Safari, so can't test)? (#foo).click( function(e) { e.preventDefault(); . On Jul 31, 9:06 am, Gordon [EMAIL PROTECTED] wrote: How does it work in newer versions of Safari? If it works in 2.x or 3.x then this is more than likely a browser bug rather than a problem with jquery in which case you should advise your client to upgrade their browser. On Jul 31, 1:53 am, NickMaller [EMAIL PROTECTED] wrote: Hi, I have the below problem happening for one of my clients, any ideas on what's the cause? I've tried a number of different things and essentially updating to the latest nightlie and removing all other javascript except for the return false on the link and the problem still persists. Bug Details: Safari 1.3.2 on OSX 10.3.9 using older version of jquery (but have tested with 1.1.3.1 with same result) does not return false on the click event defined. Offending URL:http://secure.heritageonline.com.au/OffendingJS:http://secure.heritageonline.com.au/media/javascript/jquery.heritage.js on line 66 In some cases the return false works the first time it is clicked but fails after that. In some cases it doesn't work the first time at all.
[jQuery] Re: how to catch a scroll event for the document ...
You could try $j(document).bind(scroll, function() { }); On Jun 28, 4:38 pm, Michael Stuhr [EMAIL PROTECTED] wrote: i tried: $j('body').scroll( function() { console.info ('scrolling ...'); // do sth }); but it doesn't work ... Maybe the selector is wrong, but what is the correctr one ? micha
[jQuery] Re: autocomplete caches against my will
Maybe the old autocompleters should point to Jörn's (if his is the most up to date) and recommend it as an alternative? It has been in Alpha for a while (and I think the one in SVN is more up to date). On Jul 27, 11:53 am, Dylan Verheul [EMAIL PROTECTED] wrote: Use a correct value for cacheLength and matchSubset (see docs for the original at athttp://www.dyve.net/jquery/autocomplete.txt) Tip: Use the latest and greatest autocompleter:http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ Good luck! -Dylan On 7/27/07, (null) [EMAIL PROTECTED] wrote: Hi everybody, I'm trying to use autocomplete (this one: http://www.pengoworks.com/workshop/jquery/autocomplete.htm) to suggest street names to the user while he types them. Because there can be quite a lot streets I decided to limit the result to 10 entries server-side. Now the problem: Let's assume I got 10 elements beginning with An and 10 elements beginning with At. Now the user types an A into the textbox. Autocomplete contacts the server which returns the 10 An elements. Now the user types in a t, resulting in an At. Autocomplete seems to think it got all elements starting with A and therefore all which start with At, searches it's list, finds none, shows none, although my server has 10 results for At. Now if I understand the docs right, the option matchSubset should control/disable this behaviour: matchSubset (default value: 1) Whether or not the autocompleter can use a cache for more specific queries. This means that all matches of foot are a subset of all matches for foo. Usually this is true, and using this options decreases server load and increases performance. Remember to set cacheLength to a bigger number, like 10. But it doesn't. Also the minChars - Option is completely ignored. I'd really appreciate any help! Here is my code: As an explanation for the _cityDropDownList - part: The user first selects the city and the street and of course I need to tell my site in which city the street is supposed to be. script type=text/javascript jQuery(function() { jQuery(#_streetTextBox).autocomplete(GetStreets.aspx, { minChars:5, matchSubset:0, cacheLength:1 }); jQuery(#_cityDropDownList).change(function(event){ var ac = $(#_streetTextBox).autocomplete(GetStreets.aspx); ac[0].autocompleter.setExtraParams({CityCode: jQuery(#_cityDropDownList).val()}); }); }); /script
[jQuery] Re: ANNOUNCE: jTagEditor 1.0 beta
Couple of comments: There's some inconsistency with the icons (specifically for tables). The icon with vertical line is used for inserted rows in html and wiki formats, but column in textile (which makes more sense). The one with it horizontally is for td's in html, columns in wiki and rows in textile (again, the better choice for it). There are some table icons that may be better (although there aren't any for column or cell insertion). Maybe html should have th insertion as well? Also, in wiki perhaps it should prompt you (like in the others) when no text is selected? Apart from that, this is a pretty good plugin. The silk icons are nice, but sometimes there are some that you want that aren't in the set (so you have to resort to another icon from somewhere else, possibly making it look out of place). The fact they are png means they have to be converted to gif (I've not found a good free tool that does this well, even GIMP), or a png fix applied to the page (because of IE). It's often hard finding some decent free icons (you get free ones at Icon Buffet, but they are big icons and there aren't always that many in a set). On Jul 26, 1:28 pm, Jay Salvat [EMAIL PROTECTED] wrote: My apologies ! too much emotion... ;) Here is the url:http://www.jaysalvat.com/jquery/jtageditor/ Thanks ! Bruce Wang a écrit : On 7/26/07, Jay Salvat [EMAIL PROTECTED] wrote: Hi all, I'm pleased to announce the birth of jTagEditor 1.0 beta. It's a small and customizable tag editor wich allows you to turn any textarea in a quick tag editor of any kind (html, wiki, bbcode, textile or any type of tag you want). any url? -- simple is good http://brucewang.net http://twitter.com/number5 skype: number5
[jQuery] Re: Moving Plugins to new repository
Is the old list still going to be archived (incase some plugins are not updated by the original author and someone takes it over)? On Jul 24, 3:30 pm, Yehuda Katz [EMAIL PROTECTED] wrote: I'm not sure how many folks have noticed, but an excellent new plugin repository was activated with little fanfare a few weeks ago athttp://jquery.com/plugins. At the moment, we've had a plugin list athttp://docs.jquery.com/Plugins, which is where the main plugin link points to. Because of the incredible new features of the new plugin repository, we are going to switch the link over to use it instead of the old wiki page. As a result, we're requesting that all plugin authors add an entry in the new repository with as much detail as possible. We're going to flip the switch on August 1, so again, please get everything moved over as soon as you can. While you're at it, it might be useful to determine whether your plugins still work with the latest version of jQuery. Additionally, all jQuery.fnplugins should return a jQuery object for chainability, so make sure that your plugin does, in fact, do that. Thanks a ton! -- Yehuda Katz Plugin Team Leader | jQuery (ph) 718.877.1325
[jQuery] Re: ANNOUNCE: tablesorter 2.0 beta released!
On Jul 17, 2:57 pm, Christian Bach [EMAIL PROTECTED] wrote: 2007/7/17, Rick Pasotto [EMAIL PROTECTED]: On Tue, Jul 17, 2007 at 03:04:59PM +0200, Christian Bach wrote: The new 2.0 release can be found here: http://lovepeacenukes.com/tablesorter/2.0/ Interesting that the packed version is twice as large as the unpacked. :-) Yeah, packer doesn't always work as expected :) That's not the case for me (the sizes are mixed up on the page). The normal one is 13.15 kb for me and the packed on is 6.73kb. If you pack using the Base62 encode option you can get it even smaller.
[jQuery] Re: .click() fails in 1.1.3 (work in 1.1.2)
I didn't expect it to be changed in a 1.1.x release (as it is a significant change), so maybe 1.1.2 is a safer bet for many, until 1.1.4 (will be fixed then?). So perhaps from now on it would be better to do $(a).bind(click, clickFn) to bind and $(a).trigger(click) to click? bind and trigger are staying for the foreseeable future though aren't they? On Jul 12, 2:34 pm, John Resig [EMAIL PROTECTED] wrote: That's correct - jQuery no longer interacts with events that are bound using old event handlers. Although, this could probably be resolved. Could you file a bug on this in the bug tracker?http://dev.jquery.com/ --John On 7/12/07, Bin [EMAIL PROTECTED] wrote: script src=http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.js;/ script a href=# onclick=alert('Hello');Hello/a script $(a).click(); /script this page will automaticly show alert window under 1.1.2, but not in 1.1.3.1
[jQuery] Re: addClass only works once
Have you tried using .hide() and .show() instead of addClass? Less code (both JavaScript and CSS). Unless the class 'show' has more than just display: inline? On Jul 12, 1:15 pm, stef [EMAIL PROTECTED] wrote: Im using the code below to display / hide form fields depending on what value is selected from a drop down list (id='category'). the optional form fields are all hidden by default when DOM is ready, using $(document).ready(function() { $(#dimensions).addClass(hidden) $(#size).addClass(hidden) $(#language).addClass(hidden) $(#inthebox).addClass(hidden) $(#color).addClass(hidden) }); when i select games, the p's with id 'dimensions' and 'inthebox' appear - so far so good. when i then select accessoires, 'dimensions' and 'inthebox' should get hidden by adding the class 'hidden' (.hidden{display:none;}) - but this never works! any ideas why? firebug shows no errors ... $(document).ready(function() { $(#category).change( function() { if ($(#category).val() == games) { $(#dimensions).addClass(show) $(#inthebox).addClass(show) } else if ($(#category).val() == accessoires) { $(#dimensions).addClass(hidden) $(#inthebox).addClass(hidden) } }); });
[jQuery] Re: Queuing Async Ajax requests in jQuery
You may also want to cancel Ajax requests (as is the case with autocomplete), but I don't know if you can do that with jQuery. Maybe something like: $.ajax({ type: GET, url: autocomplete.php, queue: autocomplete, cancelExisting: true }) Which would cancel an existing request in the 'autocomplete' queue if a new request is made and the old request hasn't finished. Maybe also a function to stop all current requests? $.stopAjax(function(){alert(All Ajax requests stopped)}) or those in a queue $.stopAjax(autocomplete, function(){alert(autocomplete Ajax requests stopped)}) On Jul 11, 5:01 pm, Mike Hostetler [EMAIL PROTECTED] wrote: Hi All- I recently ran into a situation similar to the one shown in this screencast: http://www.phppatterns.com/stuff/latency.html The short version: Rapidly dispatched Asynchronous Javascript requests don't always return to the client in the same order they were sent, introducing odd behavior. In my experience, 99.9% of the time, this is not an issue. However, that 0.1% is killing me. I wanted to start some discussion about whether this might be addressed within jQuery, how to address it, should it be a plugin, etc. I'd be happy to write one. Additional Links on the topic:http://www.sitepoint.com/blogs/2006/11/16/race-conditions-ajax-and-se...http://www.sitepoint.com/blogs/2006/02/10/ajaxlocalhost/http://ajaxblog.com/archives/2005/06/01/async-requests-over-an-unreli...
[jQuery] Re: Scroller ticker...
Not quite the same as it fades in rather than scrolls. Sliding could be done if you replace fadeOut with slideUp and fadeIn with slideDown Example: http://www.texotela.co.uk/code/jquery/newsticker/slide/ On Jul 9, 5:21 pm, Sean Catchpole [EMAIL PROTECTED] wrote: I like newsticker: http://www.texotela.co.uk/code/jquery/newsticker/ ~Sean
[jQuery] Re: Thickbox Reloaded
Perhaps it needs a new name as well (rather than just 'Thickbox Reloaded'), because it does function slightly differently to Thickbox? On Jul 10, 2:32 pm, Joel Birch [EMAIL PROTECTED] wrote: On 11/07/2007, at 12:25 AM, Alexandre Plennevaux wrote: Hi Klaus, I personally am looking very much forward to your implementation. I like its design much more than TB3, with all due respect to the script that converted me to jquery. Just an encouragement ;) Alexandre Ditto! Still very much looking forward to TB Reloaded. Joel Birch.
[jQuery] Re: Manipulating a stylesheet directly
I don't know if this will help (does not depend on jQuery): http://webdevel.blogspot.com/2006/06/create-css-class-javascript.html It's not been compared with using jQuery to alter CSS, but I think it may be faster. It modifies the CSS properties directly (replaces them with what you enter). It adds a style to a page if one does not exist (i.e. there are no stylesheets linked, or style elements in the document). On Jul 4, 10:39 am, Gordon [EMAIL PROTECTED] wrote: When working with jquery and javascript in general I have found that manipulating DOM attributes, especially those associated with the appearence of an element, can be rather slow. In one script I am working on I have to animate a group of elements at once, but each element has to get a different top and left position. This means that each element must get its own top and left styles. Another thing the loop has to do is change the width and height of the elements being processed, but in this case all elements get the same dimensions. The loop currently manipulates 4 attributes per element (style.width, style.height, style.top, style.left) and can get rather slow when working with a large number of elements. this.each (function (thisElemNum) { var elem = $(this); // Calculate the new position and dimensions for the element var newProps= { left: someLeftVal, top : someTopVal, width : 100, height : 100 }; elem.animate (newProps, speed) }); (The width and height can change from one invokation of the loop to the next, but for each invokation they remain constant for all iterations) One idea that occured to me is that instead of animating the width and height on a per-element basis, I could use CSS to define the width and height and then animate those attributes by changing the width and height degined in the stylesheet. This would mean only animating 2 attributes per element, plus a further 2 in the stylesheet as opposed to 4 attributes per element, which should hopefully lead to a considerable speedup. I would give all the elements a class, define a width and height for that class in the stylesheet and then change that with animate() in order to change the width and height of all elements similtaniously. The only problem is I have no idea how to go about doing it. Is doing what I want to be able to do even possible? If so, how do I get at the stylesheet node and manipulate it like I would a DOM element?
[jQuery] Re: Is it possible to show elements that is not CSS display:none;?
You could always preload images before hand (no need to use CSS tricks). http://www.texotela.co.uk/code/jquery/preload/ On Jul 5, 3:02 am, Jon [EMAIL PROTECTED] wrote: What's better than asking, is testing.. div style=position:absolute;left:-2000px; img src=path to image/ /div Much better.. Sorry if you felt I've wasted your time. On 5 Jul., 03:25, Jon [EMAIL PROTECTED] wrote: Hi Benjamin. I would like to put visibility: hidden in my css for the elements (it's thirty something divs with an image set as background) and then use jQuery to display them. But so far I haven't had any success with that approach - it only works if I set the css to display:none. By doing so the browser won't download the images until the style is changed (which is what jQuery does) but that looks awful in IE6. I thought about just turning it off if it's IE6 (it's just eye candy) but I'm not sure how to distinguish between IE6 and IE7. Sadly jQuery only offers $.browser.msie. I've been digging in Ext to see how they do it but only found isIE flag code. And I'm running out of time so... :-( puh I'm gonna grab another cup of coffee.. Do you think it would work if I use div style=position:absolute;left:-2000px; img src=path to image/ /div instead of background images? On 5 Jul., 03:01, Benjamin Sterling [EMAIL PROTECTED] wrote: Jon, I don't completely understand what you are asking for; Are you asking if there is a way to preload images and have them hidden with out display:none? If so: div style=position:absolute;left:-2000px; img src=path to image/ /div Are you asking for filter out elements with display:none? If so: $('*').filter(':hidden'); // I may be wrong on this one On 7/4/07, Jon Ege Ronnenberg [EMAIL PROTECTED] wrote: Hi all! Is it possible to show elements that is not CSS display:none;? In my case I'm showing some pictures and I don't like that the browser only downloads the pictures when I show them through jQuery. I would prefer if the browser downloaded all the pictures and then I would show them though jQuery. I know I can do it by changing the CSS instead of using show(), animate, slideDown etc. But I like the easing effect and I'm not sure of to achieve that by setting css. Any ideas to a workaround or someone who can explain to me why jQuery took this approach? Thanks! Don't misunderstand me - I really like jQuery (and especially its simplicity). -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com
[jQuery] Re: opacity in IE6.0 not works with jquery-1.1.3
While it doesn't exist as a CSS property in IE 6, you used to be able to do $(#foo).css(opacity,0.8) and it would still apply the opacity the the element(s) it was applied to. On Jul 4, 10:13 am, SeViR [EMAIL PROTECTED] wrote: In IE 6 CSS opacity doesn't exists, you must use filter:alpha(opacity=50) so $(div).css({filter:alpha(opacity=50)}); //Only in browser = IE6 or better $(div).fadeTo(fast, 0.5, function(){ alert(Animation Done.); }); //cross-platform opacity mouqx xu escribió: following is a simple, the opacity does not works in IE6.0. Is this a bug, or should I use other expressions? html head script type=text/javascript src=/js/jquery/jquery-1.1.3.js/script !--script type=text/javascript src=/js/jquery/jquery-1.1.2.js/script--!-- this works-- script function test(){ $(div).css({ position: absolute, top: 0, left: 0, opacity: 0.5, width: 100, height: 100, backgroundColor: red}) .appendTo(document.body).text(hihi) } $(test) /script style type=text/css #test{ position: relative; width: 400px; height: 400px; border: 1px solid green; background-color: blue; } /style /head body div id=testasdfasdfasdfa/div /body /html -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] Re: opacity in IE6.0 not works with jquery-1.1.3
While it is fixed in SVN, I would rather wait till the next release (1.1.3.1 rather than 1.1.4). So for the time being, I am sticking with 1.1.2 (for work related sites). On Jul 4, 11:33 am, Francisco José Rives [EMAIL PROTECTED] wrote: Fixed in the latest trunk version :-D
[jQuery] Re: jQuery 1.1.3+ jBlock-Pluggin
On a related note, do you need the iframe hack for IE7 (as I thought the 'select ignoring zindex' bug was fixed)? e.g. on line 208 change var f = ($.browser.msie) ? ... to var f = (this.ie6) ? ... Not that that is really a priority fix. On Jul 3, 3:55 am, Mike Alsup [EMAIL PROTECTED] wrote: Brandon's fix corrected the problem on IE7. Note that you'll need the latest blockUI (v1.25) for proper operation in IE6. http://jqueryjs.googlecode.com/svn/trunk/plugins/blockUI/jquery.block... Mike On 7/2/07, Sam Collett [EMAIL PROTECTED] wrote: A simple test in head: script type=text/javascript src=js/plugins/jquery.blockUI.js/ script script type=text/javascript !-- $( function() { $.extend($.blockUI.defaults.overlayCSS, { background-color : #000 }); $.blockUI(strongBlockUI Test. Click to close/strong); $(document).bind(click, function(e) { $.unblockUI(); } ) } ); //-- /script You should still see the contents, rather than just black. On Jul 2, 1:31 pm, Mike Alsup [EMAIL PROTECTED] wrote: Oscar, BlockUI works fine in 1.1.3, but there may be an issue with using a semi-transparent message. I don't think I've ever tried that myself. Mike On 7/2/07, oscar esp [EMAIL PROTECTED] wrote: Seems that block pluggin doens't work the same way with jQuery 1.1.3 With 1.1.2: - I had jBlock message with filter opacity in order to show a message with semi transparent background. With 1.1.3: - Same code doesn't maintain the opacity and now is 100% (0 transparency).
[jQuery] Re: 1.1.3 breaks opacity effects in IE?
This also affects the blockUI plugin which also uses opacity. On Jul 2, 12:36 pm, Gordon [EMAIL PROTECTED] wrote: I noticed after upgrading to 1.1.3 that animations that had an opacity component no longer occured in IE7. They would just remain opaque until the animation was due to terminate at which point thery would all just immideately vanish. I swapped fadeIn and fadeOut with show and hide, which has both a resize and an opacity component, and I found that while the sizing part of the animation played the fading part didn't happen.
[jQuery] Re: jQuery 1.1.3+ jBlock-Pluggin
Looks like a regression - which, due to it being visual, has to be inspected by eye rather than a test suite. On Jul 2, 11:06 am, Toine [EMAIL PROTECTED] wrote: same problem here something like that does'nt work with 1.1.3 : javascript:alert($('div').css({opacity: '0.5'}))
[jQuery] Re: 1.1.3 breaks opacity effects in IE?
The blocking is fine, it's just the background is completely black (or whatever colour you set for the overlay): http://www.texotela.co.uk/blockUI.php On Jul 2, 1:29 pm, Mike Alsup [EMAIL PROTECTED] wrote: This also affects the blockUI plugin which also uses opacity. Sam, BlockUI doesn't have any problems with 1.1.3. I'm seeing the same issue that Gordon pointed out with IE7 and animations, but blockUI works fine. Mike
[jQuery] Re: jQuery 1.1.3+ jBlock-Pluggin
A simple test in head: script type=text/javascript src=js/plugins/jquery.blockUI.js/ script script type=text/javascript !-- $( function() { $.extend($.blockUI.defaults.overlayCSS, { background-color : #000 }); $.blockUI(strongBlockUI Test. Click to close/strong); $(document).bind(click, function(e) { $.unblockUI(); } ) } ); //-- /script You should still see the contents, rather than just black. On Jul 2, 1:31 pm, Mike Alsup [EMAIL PROTECTED] wrote: Oscar, BlockUI works fine in 1.1.3, but there may be an issue with using a semi-transparent message. I don't think I've ever tried that myself. Mike On 7/2/07, oscar esp [EMAIL PROTECTED] wrote: Seems that block pluggin doens't work the same way with jQuery 1.1.3 With 1.1.2: - I had jBlock message with filter opacity in order to show a message with semi transparent background. With 1.1.3: - Same code doesn't maintain the opacity and now is 100% (0 transparency).
[jQuery] Re: 1.1.3 breaks opacity effects in IE?
It is not something you can catch by writing automated tests, so it is understandable that it may have been missed. Perhaps this (and whatever major issue is left) will mean a 1.1.3.1 release soon? On Jul 2, 4:42 pm, Brandon Aaron [EMAIL PROTECTED] wrote: I just checked in a fix for the IE opacity issues. Sorry guys ... we did so much testing and preparing for this one ... just can't catch them all I suppose. I think we have one more major issue to squash in 1.1.3 and then we will do another bug fix release. In the mean time just grab the latest from SVN if you can. -- Brandon Aaron On 7/2/07, Mike Alsup [EMAIL PROTECTED] wrote: Sorry about that, Sam. You're quite right. I was testing with the wrong release. The opacity is not working correctly in IE7. Is IE6 working? Virtual PC is giving me fits at the moment. Mike On 7/2/07, Sam Collett [EMAIL PROTECTED] wrote: The blocking is fine, it's just the background is completely black (or whatever colour you set for the overlay): http://www.texotela.co.uk/blockUI.php On Jul 2, 1:29 pm, Mike Alsup [EMAIL PROTECTED] wrote: This also affects the blockUI plugin which also uses opacity. Sam, BlockUI doesn't have any problems with 1.1.3. I'm seeing the same issue that Gordon pointed out with IE7 and animations, but blockUI works fine. Mike
[jQuery] Re: 1.1.3 breaks opacity effects in IE?
It doesn't seem to work at all in IE6 (through VPC) - the overlay doesn't cover the screen (only a small band at the bottom) and the box is actually in the background. On Jul 2, 4:34 pm, Mike Alsup [EMAIL PROTECTED] wrote: Sorry about that, Sam. You're quite right. I was testing with the wrong release. The opacity is not working correctly in IE7. Is IE6 working? Virtual PC is giving me fits at the moment. Mike On 7/2/07, Sam Collett [EMAIL PROTECTED] wrote: The blocking is fine, it's just the background is completely black (or whatever colour you set for the overlay):http://www.texotela.co.uk/blockUI.php On Jul 2, 1:29 pm, Mike Alsup [EMAIL PROTECTED] wrote: This also affects the blockUI plugin which also uses opacity. Sam, BlockUI doesn't have any problems with 1.1.3. I'm seeing the same issue that Gordon pointed out with IE7 and animations, but blockUI works fine. Mike
[jQuery] Validation Plugin - hows to only fire on form submit?
Is it possible to only run validation when the form is submitted? I am using version 1.1 of the validation plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-validation/) I want to do something only when the form is submitted, so tried this basic code: $(form).validate( { showErrors: function(errors) { alert(should only fire on submit); } }) The alert shows when I try to submit the form, and also when I click the page after dismissing the alert. Test page: http://www.texotela.co.uk/validation.php
[jQuery] Re: BlockUI and unBlockUI after validation routine
Looks like you are missing the brackets: $.unblockUI(), not $.unblockUI On Jun 28, 11:09 am, Web Specialist [EMAIL PROTECTED] wrote: Hi all. I'm trying to use BlockUI to show a message while a validation routine occurs in my form. Looks like this: $(document).ready(function(){ /* when user fires submit button blockUI shows a wait message - WORKS FINE */ $(function() { $('#SaveInfoButton').click(function() { $.blockUI(); }); }); /* all long long long time form validation routine */ $.unblockUI; // DOESN'T UNBLOCK - WHY??? blockUI works fine showing a message but unblockUI doesn't. What's wrong? Is it possible to do? Cheers
[jQuery] Re: Validation Plugin - hows to only fire on form submit?
The validation doesn't fire on element blur before you submit the form (only after), perhaps it may be a bug? What I want to do is show a message when the form is submitted, not when an element loses focus (but also want the error class to be added to an element when it is not valid). What may be a good solution (but would probably mean a change to the plugin by Jörn) is if there was a way to know what element fired the validation and what event (blur, submit etc) was the trigger. On Jun 28, 11:20 am, Rob Desbois [EMAIL PROTECTED] wrote: Sam, On the API documentation page have a look at the examples for .validate() -http://jquery.bassistance.de/api-browser/plugins.html#validateMap There is a parameter called 'event' which seems to control when each input is validated, its use is shown a couple of times. This isn't documented but shouldn't be too hard to work out its semantics - I'd love to help further but haven't used the validate() plugin myself. HTH, --rob On 6/28/07, Sam Collett [EMAIL PROTECTED] wrote: Is it possible to only run validation when the form is submitted? I am using version 1.1 of the validation plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-validation/) I want to do something only when the form is submitted, so tried this basic code: $(form).validate( { showErrors: function(errors) { alert(should only fire on submit); } }) The alert shows when I try to submit the form, and also when I click the page after dismissing the alert. Test page:http://www.texotela.co.uk/validation.php -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: Validation Plugin - hows to only fire on form submit?
While it is not exactly the best way to do it (it uses undocumented settings), I have found a solution, but still have one issue - the showErrors function still runs when there are no errors (i.e. the errors parameter is an empty object). var validator = $(form).validate( { onblur: function(){}, onkeyup: function(el) { if(validator.check(el)) $(el).removeClass(validator.settings.errorClass); else $(el).addClass(validator.settings.errorClass); }, showErrors: function(errors) { alert(should only fire on submit); } }); On Jun 28, 11:44 am, Sam Collett [EMAIL PROTECTED] wrote: The validation doesn't fire on element blur before you submit the form (only after), perhaps it may be a bug? What I want to do is show a message when the form is submitted, not when an element loses focus (but also want the error class to be added to an element when it is not valid). What may be a good solution (but would probably mean a change to the plugin by Jörn) is if there was a way to know what element fired the validation and what event (blur, submit etc) was the trigger. On Jun 28, 11:20 am, Rob Desbois [EMAIL PROTECTED] wrote: Sam, On the API documentation page have a look at the examples for .validate() -http://jquery.bassistance.de/api-browser/plugins.html#validateMap There is a parameter called 'event' which seems to control when each input is validated, its use is shown a couple of times. This isn't documented but shouldn't be too hard to work out its semantics - I'd love to help further but haven't used the validate() plugin myself. HTH, --rob On 6/28/07, Sam Collett [EMAIL PROTECTED] wrote: Is it possible to only run validation when the form is submitted? I am using version 1.1 of the validation plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-validation/) I want to do something only when the form is submitted, so tried this basic code: $(form).validate( { showErrors: function(errors) { alert(should only fire on submit); } }) The alert shows when I try to submit the form, and also when I click the page after dismissing the alert. Test page:http://www.texotela.co.uk/validation.php -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: jquery is'nt very effective at execution
Using $(td.Name) should also improve the scripts performance as well. When you use $(.Name) it will go through all tags on the page. If the class name is on other tags as well, you could always add another selector (e.g. $(td.Name, li.Name). On Jun 11, 3:02 am, Dan G. Switzer, II [EMAIL PROTECTED] wrote: Thank you. Is it possible to interrupt the script each time the user enter a new letter in the search box ? What I'd recommend doing is building in a setTimeout() delay that would only fire off the event if the user pauses typing--that way you're not trying to fire it off for every keystroke. As for stop the each(), if you do a return true/false inside the callback function, it should stop execution of the loop. This means you can add a condition to the loop based on a global variable to determine if you should stop the loop. So, something like the following would work: $(.Name).each( function (){ // provided lastTbxValue is a global value that's updated each // time the value changes, this should stop the loop if( tbxValue != lastTbxValue ) return false; // create a pointer to the current table cell var oCell = $(this); // hide the parent oCell.parent().[oCell.text().indexOf(tbxValue) -1 ? show : hide](); } ); -Dan