[jQuery] Re: Problem with BlockUI and IE7
Mike, Sorry for the delay in getting back to you. I don't think a test case will help, as I can only reproduce this problem on this one internal server (our new server). The demo page works fine, and blockUI works fine on our old server. It only seems to fail on our new server. Carl Mike Alsup wrote: Unfortunately, both servers are behind our firewall and inaccessible from the outside, so I can't provide a link. Surely you can create a simple test page that shows the problem? Do you see this problem on the demo pages? http://jquery.malsup.com/block/
[jQuery] Problem with BlockUI and IE7
I am migrating an application from one server to another. Both servers are Windows 2003, similarly configured. The only major difference is that I use ColdFusion for my CFML engine on my old server, and BlueDragon JX on my new server. Here is the problem: On my new server, when browsing using IE7, when $.unblockUI is called, the message is removed, but the iframe and the divs that BlockUI creates are not removed. It works fine in Firefox 3.06. I can consistently reproduce this problem with any page that uses blockUI. On the old server, there were no problems with BlockUI. Unfortunately, both servers are behind our firewall and inaccessible from the outside, so I can't provide a link. I've verified that my jquery file (jquery-1.2.6.min.js) and blockUI file (jquery.blockUI.js) match each other on the two servers. Any ideas? Carl
[jQuery] Re: OT: CF-Talk Down?
Rick, Here is how I handle creating json content with ColdFusion. I store the json string in a variable (like variables.myJSONdata). Then, I output the variable as follows: cfcontent reset=yes / cfheader name=expires value=#now()# cfheader name=pragma value=no-cache cfheader name=cache-control value=no-cache, no-store, must- revalidate cfoutput#myJSONdata#/cfoutputcfabort / !--- The cfabort prevents CF from adding anything else to the output, including debugging info. --- The first line clears anything CF might have rendered to the page up to this point. The second through fourth lines prevent the browser from caching the AJAX response. The last line outputs the json data then immediately aborts CF processing, effectively stopping any additional content being added onto the end. HTH, Carl On Jan 28, 2:04 pm, Rick Faircloth r...@whitestonemedia.com wrote: Perhaps I could ask you a question, Josh. I've been stuck on a CF/jQuery ajax issue for a day now and went to post my question to CF-Talk about the time it went down. Basically, I got everything working, but in my json response, beside the correct data, I get CF debugging code. I have cfsetting showdebugoutput = no, so that's not it. I just wonder what could be causing that to appear...any suggestions?j Rick
[jQuery] Re: .hide() and .height()
Karl, How would one go about overriding jQuery's show() and hide() functions to move the desired element to a negative screen position (CSS left: -1) instead of changing the CSS display to none? Carl Karl Swedberg wrote: On Jan 16, 2009, at 7:56 PM, Michael Geary wrote: snip If you want an element to become invisible but remain part of the layout, then set .attr({visibility:'hidden'}) instead of using .hide(). Use .attr({visibility:'visible'}) to display it again. Excellent explanation, as always, Mike. One oops, though: .attr({visibility:'hidden'}) and .attr({visibility:'visible'}) should be .css({visibility:'hidden'}) and .css({visibility:'visible'}) --Karl Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com
[jQuery] Re: Problem with .remove() in IE7
Has anyone else come across this? This is happening on all of my report pages. Thanks, Carl Carl Von Stetten wrote: Hi, I'm using jQuery 1.2.6.min.js on an intranet application. I have a page that when loading, displays a report loading message with an animated gif. This report loading stuff is located within a div called wait. When the document finishes loading, I want to remove this div. Here is an abbreviated form of my jQuery ready function: $(document).ready(function() { a bunch of code here unrelated to my div $(#wait).remove(); }); This works fine in Firefox 3 - the div is removed. In IE7, the div is removed but I get a ubiquitous Object required error. If I comment out this one line of code, I don't get any errors. I also tried using hide() instead of remove(), but got the same error. Any ideas about what I'm doing wrong? Thanks, Carl
[jQuery] Loading jQuery plugins as needed from scripts
I've been exploring several options to load various jQuery plugins only when needed, from within a javascript file. I've used the .getScript() method, with callbacks. I've used the $ (body).append(script) method also. They work fine, but with one shortcoming. Because both of these methods append a jQuery id number to the script's file name, the scripts are reloaded every time the page is called. It doesn't allow the browser to reuse the scripts that have already been downloaded into the cache. Are there any other alternatives? I have a separate .js file for each web page, and in that .js file I only want to load the additional jQuery plugins I need for that particular page. Thanks, Carl
[jQuery] Re: jquery ui demo site
Bhaarat, While there is no plugin for the UI demo, you can download the javascript file that makes it work. It does use jQuery and UI to work. If you view source on the demo page, you can examine the scripts being loaded. The file you are interested in is Behaviour.js. Carl [EMAIL PROTECTED] wrote: Dear sir please search on google ImageFlow you could find some Plugin I'm afraid to say there is no JQery Plugin on this matter On Thu, Sep 4, 2008 at 12:36 AM, Bhaarat Sharma [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am wondering whether jquery ui demo site is written in jquery (would be ironic if its not ) http://ui.jquery.com/demos it looks very appealing how they have things going in a semi-circle. I am wondering if this is doable via jquery? and if soare there any plugs to achieve this or anything similar w/ tutorial? Thanks!
[jQuery] Re: $.get(0) is causing trouble
jquertil, Try: $all[0].css('color','#339900'); or $all.eq(0).css('color','#339900'); As Alexsandro pointed out in his response, .get(0) returns the actual DOM element, not a jQuery object, so you can't use jQuery functions (like .css) on it. Carl jquertil wrote: $all = $('.listing .myDivs'); $all.get(0).css('color','#339900'); why would this throw an error function css does not exist ?? I tried this too with no luck: $('.listing .myDivs').get(0).css('color','#339900');
[jQuery] Re: 'nodeName' is null or not an object
You might try adding the .each() function before your .load() call. Carl Pickledegg wrote: its 'c_name'. I've discovered something now, if I just use 1 div as the selector to update only 1 div, $('#charges-gsm) it works fine. But when I add multiple ones: $('#charges-gsm,#charges-gsm-faq,#charges-gsm-prices') thats when I get the error...I know that the divs exist and it works in FF, but why not IE? On Jul 9, 4:31 pm, Mike Alsup [EMAIL PROTECTED] wrote: I have the following code that loads on $(document).ready: - $('.ajaxdropdown').change(function(){ $('#charges-gsm, #charges-gsm-faq, #charges-gsm-prices').load('/ mobell/includes/html/gsm-tariff.php?c_name='+escape($(this).val())); - Its pretty self explanatory, but to summarise I have three divs on my page - (#charges-gsm, #charges-gsm-faq #charges-gsm-prices) which update with the content of the ajax load. The trigger for this event is from dropdowns on the page, which have the class '.dropdown'. All works well in Firefox Safari, but in IE (67) I get no content in my divs and the following error: 'nodeName' is null or not an object I've narrowed it down to the line that mentions .ajaxdropdown, so I think its because IE is having trouble finding the element, but I've tried putting other selectors in instead of .ajaxdropdown, and its the same error. Can anyone see why it may be happening? Thank you. What is the name attribute of the .ajaxdropdown element?
[jQuery] Re: Ho to remove or add a new table row?
Yavuz, That's because view source only shows the HTML as it was originally loaded. It does not show any DOM changes that may have been made after the page was initially loaded. If you have Firefox, and install the Developer Toolbar, the View Source pulldown on the toolbar offers View Generated Source, which will show you exactly what your source looks like with any DOM changes included. Even better, the FireBug plugin for Firefox allows you to look at the source, and even watch it change in real time as your javascript manipulates the DOM. Carl Yavuz Bogazci wrote: I seems to work, but when i show the page-source i cant see the new rows. But they are visible in the browser. Its very strange. On Jul 9, 5:31 pm, ..:: sheshnjak ::.. [EMAIL PROTECTED] wrote: You can easily remove any row that you selected, only question is if you can select apropriate rows. $(table tr).remove(.remove); // removes any table rows that have class=remove or like this $(table tr).filter(:contains(unwantedText)).remove();// removes any row containing string unwantedText Only thing you have to watch is that your query is TR element (that was your problem, right?). If you filter by some other condition, for example children elements, then do this: $(table tr a.remove).parent().remove();// query is A tag with class=remove, so you escape it with .parent() Same thing goes with adding rows, just use .after(trInsert this row/tr) or .before(trInsert this row/tr) methods.
[jQuery] Re: using doc.ready in an external .js file
kgosser, Are you loading jQuery.js after your main.js file? If you are, try loading jQuery first, as it must be present before using any of its functions. Carl kgosser wrote: Here's what I'm not getting about jQuery from a novice point of view. Let's say I have this: script type=text/javascript $(document).ready(function() { $(#switcherBtn).click(function(){ $(#target).toggleClass(nodisplay); }); }); /script I have a function to toggle the display of a certain div. This div is on virtually all my pages, though, so instead of putting this in the header of each page, I want to put it in a global include file, for example main.js. I don't understand why copying and pasting $(document).ready(function() { $(#switcherBtn).click(function(){ $(#target).toggleClass(nodisplay); }); }); into main.js throws this error in Firebug: $ is not defined main.js()()main.js (line 1) $(document).ready(function(){ Any input?
[jQuery] Re: Removing the html jQuery adds in effects
pek, Try this (untested): $(litesting/li).hide().insertBefore(#gallery li:first).slideDown(slow); Carl pek wrote: First of all, thank you very much for the reply. It is really hard to get any reply in this mailing list. This is the third time I'm asking something and you are the first to answer. Unfortunately, I've tried this and it kinda acts weird. Instead of wrapping the litesting/li with the effect, it wraps the next element, so now the second does the slideDown effect. You can see this here: http://treazy.com/pek/album/ Just click previous and watch what happens. Do you know how to work around this? Thanks again. On Jul 3, 10:30 pm, real [EMAIL PROTECTED] wrote: This is what you would want to do: $(#gallery li:first).before(litesting/ li).hide().slideDown(slow) On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote: I have a small problem when dealing with effects. Warning: Noob question ahead. Currently I have a list of items ul id=gallery litest/li litest2/li /ul alert($(#gallery li:first).html()) will correctly echo test. If I want to add a new element before that with a slideDown effect, I use this line: $(#gallery li:first).before().html(litesting/ li).hide().slideDown(slow) Although this correctly adds the line and smoothly slides it down, now the list is like this: ul id=gallery li style=display: block; litesting/li /li litest/li litest2/li /ul The extra li with the style is added by jQuery for the effect. This isn't a problem until you want again to add something before the first element. Now alert($(#gallery li:first).html()) incorrectly (well, correctly, but not what I want anyway) returns litesting/li instead of testing which means that if I try to do the same effect with the same code it will not add before, rather, it will replace it and do the effect again. Any help? Thank you in advance. Panagiotis
[jQuery] Re: offSetTop offsetLeft return NULL
Dan, Try: var e_ox = jQuery(a).eq(index).offset().left; var e_oy = jQuery(a).eq(index).offset().top; HTH, Carl On Jul 3, 11:49 am, Dan [EMAIL PROTECTED] wrote: I have these functions: var e_w = jQuery(a).eq(index).width(); var e_h = jQuery(a).eq(index).height(); var e_ox = jQuery(a).eq(index).offsetLeft; var e_oy = jQuery(a).eq(index).offsetTop; the first 2 return numbers such as 50 and 100. But the last 2 each return NULL. Why are they returning NULL? How can I get the offset of an element given it's index in terms of a tags?
[jQuery] Re: Targeting an element with multiple classes
jez_p Try $('.green') This will select only elements that have the green class assigned, even if other classes are also assigned to the same elements. Carl jez_p wrote: How do I target a specific class when elements may belong to multiple classes? For example: p class=big redblah blah blah/p p class=big greenblah blah blah/p p class=small greenblah blah blah/p How would I select the elements with the class of green? I know that 'p[class=big green]' 'p[class=small green]' would work, but I cannot work out how I can just specify wherever there is a class of green, and not have to include the other classes also. Thanks in advance.
[jQuery] Re: Including the submit element in the querystring.
By default, the jQuery.ajax (or $.ajax) function uses the get method, which passes the data as a querystring tacked onto the url. So does the jQuery.get (or $.get) function. This is the same as a form submitted using the get method. If you are using the $.ajax function, you can set the type option to post to have it submit as form data, or you can use the jQuery.post (or $.post) function. Either way, it sends the data as form data (same as a form submitted using the post method. HTH, Carl LTG wrote: Serialize is a great method to automatically prepare a form, but it doesn't include the element that initiated the submit in the case where I attach a click event to a div and call submit from the click event. Is there a typical pattern to adding the submit element to the serialized string so the server can know which element initiated? Does it matter what format it's in? (submitter=elementId)? *bonus question* This is academic but I'm trying to learn: why does ajax put data in a querystring instead of using a form like normal html submit would do? best regards, ltg
[jQuery] Re: Tablesorter plugin and zebra striping
Ken, Tablesorter has a zebra capability built right in through the zebra widget - see the docs for the tablesorter plugin. It will automatically redo the striping after each sort. You can change your code to: $(document).ready(function() { $(table#sorttable).tablesorter({widgets: ['zebra']}); )}; HTH, Carl Ken wrote: I have the following in my $(document).ready: $(document).ready(function() { $(.zebra tr:not([th]):even).addClass(even); $(.zebra tr:not([th]):odd).addClass(odd); $(table#sorttable).tablesorter(); )}; This allows my table to sort columns by clicking on the column headers and works great. What I need to be able to do, is have the zebra striping happen after each table sort. Is there a way to set this up? Thanks, Ken
[jQuery] Re: [autocomplete] tab issue with autcomplete plugin
Jörn, I have made extensive use of the autocomplete plugin for my intranet site. I just downloaded the updated version from the trunk (changelog shows it as 1.0.1, the js file lists the build as 5329). I still have the tab order problem. Carl Jörn Zaefferer wrote: Yes, that should be fixed in the latest revision: http://dev.jquery.com/view/trunk/plugins/autocomplete/ Can you assert that it actually fixes the issue? I'll create a new release, then. On Fri, Jun 13, 2008 at 7:53 PM, Priest, James (NIH/NIEHS) [C] [EMAIL PROTECTED] wrote: Jörn, have you made any progress on the TAB issue with the Autocomplete plugin? ie: If you in that field and tab away - you loose your tab order. I know it came up in the comments on the plugin page but I haven't heard any more updates on it... Thanks, Jim
[jQuery] Re: get Request doesnt work in IE7
Don't know if this is the problem, but you're missing a semicolon (;) after the end of your $.get function call. Carl Jan S wrote: All of a sudden, xmlhttprequests don't work no more in IE7. FF perfect, no problems. Here the simple code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head titlesome title/title meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=bin/jquery/jquery.min.js/ script script type=text/javascript $(document).ready(function(){ $.get('act/load.list.php', {kind:'contracts'}, function (data) { alert(data); }) }); /script /head body /body /html The Browser does the request, but function (data) {} is never called. This problem drives me crazy!!! Please someone help. Or is it even a browser-property problem? Thanks
[jQuery] Re: Calendar Over Dialog
Tim, Are you using the css file that comes with the ui.datepicker? If so, make sure the section near the top looks like this: #datepicker_div { display: none; border: 1px solid #777; z-index: ; /*must have*/ } Note the z-index set to . Compare this to the z-index of your dialog. The datepicker's z-index should be a larger number than the dialog's z-index. HTH, Carl Tim Scott wrote: Does anyone know if there is any combination of plugins that would allow me to use a calendar control from inside a dialog? I have tried all combinations of jQuery UI dialog and calendar, BlockUI, and jQuery datePicker. The problem is, I guess, these calendars actually *are* modal dialogs too, and they do not know how to go over top of an already active dialog. Therefore they appear underneath the active dialog where the user cannot see them.
[jQuery] Re: Refactoring Functions
How about this (untested): var stickyFooter = function() { var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); } $(document).ready( stickyFooter(); ); $(window).resize( stickyFooter() ); HTH, Carl Chris P wrote: I wanted a script that would make a sticky footer, and it worked perfectly with this (where 341 is the elements to offset). var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); Then I want this code to re-run on browser resize. I also want to refactor the code above to use a second time. The problem is that (1) it doesn't re-run on browser resize and (2) I don't want to duplicate code. How can I refactor? var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); $(window).resize(function(){ var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); });
[jQuery] Re: Refactoring Functions
Better yet, change line second line of stickFooter function to: var height = $(document).height() - 341; And remove the third line entirely. Carl Carl Von Stetten wrote: How about this (untested): var stickyFooter = function() { var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); } $(document).ready( stickyFooter(); ); $(window).resize( stickyFooter() ); HTH, Carl Chris P wrote: I wanted a script that would make a sticky footer, and it worked perfectly with this (where 341 is the elements to offset). var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); Then I want this code to re-run on browser resize. I also want to refactor the code above to use a second time. The problem is that (1) it doesn't re-run on browser resize and (2) I don't want to duplicate code. How can I refactor? var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); $(window).resize(function(){ var height = $(document).height(); var height = height - 341; $('#footer').css('margin-top', height); });
[jQuery] [jqModal] How to override style properties
I've read all of the documentation on the jqModal home pages. I understand that the default CSS class jqModal looks for to style the overlay is jqmOverlay. It appears that the only properties that it will pick up from a defined CSS style are background color and background image. I'm trying to change the modal overlay cursor from 'wait' to an external cursor file in my CSS: .jqmOverlay { background-color: #000; cursor: URL(../no_m.cur), wait; } However, the cursor style is not being applied (I can confirm this in firebug - the cursor style of the overlay is being hard-coded by jqModal. Is there any way to change the cursor? Thanks, Carl
[jQuery] Re: document.createElement equivalent in jquery?
meppum, That is built into the core of jQuery. For example, to create a new p element and append it to an existing div with an id of mydiv: $('pNew paragraph/p').appendTo('#mydiv'); or $(#mydiv).append('pNew paragraph/p'); HTH, Carl meppum wrote: What is the equivalent jquery code to document.createElement? I looked all over but couldn't find an example. -meppum
[jQuery] Re: [jqModal] How to override style properties (SOLVED)
In case anyone else runs across this: in my css file I added the !important declaration after the cursor style. This causes the css style to override the user style applied by jqModal. Carl Carl Von Stetten wrote: I've read all of the documentation on the jqModal home pages. I understand that the default CSS class jqModal looks for to style the overlay is jqmOverlay. It appears that the only properties that it will pick up from a defined CSS style are background color and background image. I'm trying to change the modal overlay cursor from 'wait' to an external cursor file in my CSS: .jqmOverlay { background-color: #000; cursor: URL(../no_m.cur), wait; } However, the cursor style is not being applied (I can confirm this in firebug - the cursor style of the overlay is being hard-coded by jqModal. Is there any way to change the cursor? Thanks, Carl
[jQuery] Re: document.createElement equivalent in jquery?
meppum, Take a look at the $.getScript() function. See http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback for details. Carl meppum wrote: I was thinking more like adding a script tag to the document. Something equivalent to document.createElement(script); On May 14, 5:55 pm, Carl Von Stetten [EMAIL PROTECTED] wrote: meppum, That is built into the core of jQuery. For example, to create a new p element and append it to an existing div with an id of mydiv: $('pNew paragraph/p').appendTo('#mydiv'); or $(#mydiv).append('pNew paragraph/p'); HTH, Carl meppum wrote: What is the equivalent jquery code to document.createElement? I looked all over but couldn't find an example. -meppum- Hide quoted text - - Show quoted text -
[jQuery] Re: Dynamic Software causing many script loads, how would one handle this?
Lee, Do the various plugins at least use the same jQuery version? If so, can you modify the plugin-specific JS file to load the required jQuery scripts only if they haven't already been loaded? You will at least need to make sure that the jQuery.js (or jQuery.min.js or jQuery.pack.js) is loaded by the CMS main page. Then you might try something like this (this example specifically checks to see if jqModal and tablesorter are loaded): $.ajaxSetup({async:false}); // temporarily make ajax synchronous so your script // doesn't start executing code before required scripts // are loaded. if(!$.jqm){ // test to see if the jqModal jqm() // function doesn't exist yet $.getScript(relative path/jqModal.min.js); } if(!$.tablesorter){ // test to see if the tablesorter() // function doesn't exist yet $.getScript(relative path/jquery.tablesorter.min.js); } $.ajaxSetup({async:true)}; // restore ajax to asynchrounous mode Lee O wrote: I have an application that has many plugins, all of which have jquery scripts. Now, i imagine there are ways to program an javascript aggregator of some sort, but i imagine this is a very common problem with plugin based web-apps, so i was curious if jquery had any ways to handle this. To reiterate with an example: If you have a CMS that is plugin based, with 20 plugins, and each plugin has its own js file to run its own, plugin specific, jquery code from. You cannot(/and should not have to/) manually combine them together (ignoring the aggregator aspect for now), so are there any other options? Having 20+ script calls on one page is a bit overkill heh.. Any thoughts on this subject? Thanks, -- Lee Olayvar http://www.leeolayvar.com
[jQuery] Re: using variables with jquery
quirksmode, Try this: $('#js_innerwrapper').animate({left:+=+$.gamewidth}, 1000, 'easeOutSine'); HTH, Carl quirksmode wrote: Hi, I need to make a div slide across the screen using the animate command. It works when I use the following: $('#js_innerwrapper').animate({left:+=500}, 1000, 'easeOutSine'); However, i need to be able to change the 500 to be width of the div, which i get using: $.gamewidth = $('.gamewrapper').width(); I then need to combine the two which does not seem to work: $('#js_innerwrapper').animate({left:+=$.gamewidth}, 1000, 'easeOutSine'); Any ideas?
[jQuery] Re: Way to designate links as form submitters?
Rick, Try this (untested): $(document).ready(function() { $.each(.formlink), function() { $(this).click(function() { $(#supporttype).val($(this).attr(id); $(#supportform).submit(); }); }); }); form id=supportform name=supportform method=post action=yourscriptname.cgi input type=hidden id=supporttype name=supporttype / a class=formlink id=PaidPaid Support/a or a class=formlink id=FreeFree Support/a HTH, Carl Rick Faircloth wrote: As a follow-up to my question, I found this method that utilizes regular JS, but I'd like to be able to cause any link with a certain id to act as a Submit Link. Here's the code I found to create a text submit link: script language=JavaScript type=text/javascript !-- function getsupport ( selectedtype ) { document.supportform.supporttype.value = selectedtype ; document.supportform.submit() ; } -- /script form name=supportform method=post action=yourscriptname.cgi input type=hidden name=supporttype / a href=javascript:getsupport('Paid')Paid Support/a or a href=javascript:getsupport('Free')Free Support/a Thanks for any help in changing this to jQuery! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Thursday, May 01, 2008 12:08 PM To: jquery-en@googlegroups.com Subject: [jQuery] Way to designate links as form submitters? Anyway to do that? Have certain links, say with an id of link, to be programmed to submit a form when clicked? Rick
[jQuery] Re: tablesorter bug?
After making changes to the table, use this instead: $('#myTable').trigger(update); // rebuilds the tablesorter data cache If you have added rows and need to resort, try either this: $(#myTable).trigger(sorton,[sorting]); // where [sorting] is the JS array of the sorting column info (see docs) or: var sorting = $(#myTable)[0].config.sortList; // grabs the current tablesorter sorting configuration $(#myTable).trigger(sorton,[sorting]); // resorts using the current tablesorter configuration HTH, Carl A13thGuest wrote: The tablesorter is acting goofy and I'm wondering if anyone has any insight to the problem or a way to fix it. I'm adding rows to a table then calling tablesorter: $('#myTable').tablesorter(); Works fine. If I clear rows from the table then add more rows, I call tablesorter again: $('#myTable').tablesorter(); When I try to sort, records that were previously removed pop into my table again. There doesn't seem to be a way to clear the tablesorter before reloading it with the new table results. For example: $('#myTable').tablesorter('destroy'); $('#myTable').tablesorter(); Any suggestions? Thanks in advance.
[jQuery] Re: Ajax and events
Peps, Look into the LiveQuery plugin. It monitors the DOM, and automatically binds events to new elements created from ajax requests. There are other methods to do this is well. Check out this jQuery FAQ: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F HTH, Carl Peps wrote: Hi, I have finished developping a website with jQuery. First of all, thanks to everybody who worked on this great Javascript library. It's truly an incredible timesaver. My question concerns binding and unbinding events when there are Ajax calls in which content is injected into the DOM. At first I noticed that the newly injected elements where not affected by the original event bindings. I realized I had to rebind everything on each Ajax calls. However that was not the end of my problems. I noticed that when you rebind everything, all the elements which were not injected in the DOM through the Ajax calls were actually binded double! My final strategy has been to unbind everything on each ajax calls and THEN rebind every event (a 12kb JS file) within the file which was called through the ajax request. This works on all browser and the speed is good. I know however that this is probably not the best way to go... Does anyone have any advice which they could give me? Thank you.
[jQuery] Re: jQuery for loop - am I crazy?
How about this? function initDashboard() { $(document).ready(function() { if($(.adminMsgSummary).length) { $(.adminMsgSummary dl:not(first)).hide(fast); } } } Code not tested, but should work. Carl cloudsteph wrote: I think I may have been looking at this a little too long or something to cause it not to work coz it seems like it should be pretty simple to do, but it no work for me :( What I want to do is loop through all the dl elements within a certain div and hide all of them except for the first one. Here's my broken code: function initDashboard(){ $(document).ready(function(){ if($(.adminMsgSummary).length 0){ var theCount = $(.adminMsgSummary dl).length-1; for(z=1;z=theCount;z++){ var theDl = $(.adminMsgSummary dl); theDl[z].hide(fast); } } }); } Any ideas??
[jQuery] Problem with using hasClass() within .each()
Using jQuery 1.2.3 Firefox 2.0.0.14 I am trying to loop through the headers of a tablesorter table and find out which columns are being sorted which way. I'm building an array of arrays that can be fed into the tablesorter.trigger function to resort the table after changes are made to the DOM. The problem I'm having is after .each() iterates successfully through the first two columns (which currently are sorted) it then crashes on .hasClass(). When I say crashes, I mean that Firebug reports the following at the Console: $(this).hasclass is not a function Here is a snippet of my code. The id of the table in question is rdlist. var columnsort = new Array(); parent.$(#rdlist th).each(function(idx){ var curhead = new Array(); if($(this).hasClass(headerSortDown)){ curhead.push(idx); curhead.push(0); } else if($(this).hasclass(headerSortUp)){ curhead.push(idx); curhead.push(1); } if(curhead.length)columnsort.push(curhead); console.log(columnsort); }); What am I doing wrong? :-(
[jQuery] Re: Problem with using hasClass() within .each()
Josh, Thanks a million. Can't believe I missed that. It's working great now. Carl Josh Nathanson wrote: Carl -- Javascript is case-sensitive, so you have to use hasClass rather than hasclass each time you call it. -- Josh - Original Message - From: Carl Von Stetten [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Wednesday, April 16, 2008 5:38 PM Subject: [jQuery] Problem with using hasClass() within .each() Using jQuery 1.2.3 Firefox 2.0.0.14 I am trying to loop through the headers of a tablesorter table and find out which columns are being sorted which way. I'm building an array of arrays that can be fed into the tablesorter.trigger function to resort the table after changes are made to the DOM. The problem I'm having is after .each() iterates successfully through the first two columns (which currently are sorted) it then crashes on .hasClass(). When I say crashes, I mean that Firebug reports the following at the Console: $(this).hasclass is not a function Here is a snippet of my code. The id of the table in question is rdlist. var columnsort = new Array(); parent.$(#rdlist th).each(function(idx){ var curhead = new Array(); if($(this).hasClass(headerSortDown)){ curhead.push(idx); curhead.push(0); } else if($(this).hasclass(headerSortUp)){ curhead.push(idx); curhead.push(1); } if(curhead.length)columnsort.push(curhead); console.log(columnsort); }); What am I doing wrong? :-(