[jQuery] Re: Superfish Dropdown BG Problem
bklyn2cali - I see that you resolved the background issue on your site. What did you do and where did you do it??? With regards, Ron On Feb 1, 10:12 am, bklyn2cali s...@mediajelly.com wrote: Joel or anyone else, I have one last problem. The SuperSubs plugin works only on the first sub-sub- nav. I'm not sure why. Take a look here and see the second sub nav's display:http://www.stcyril.net/site/ It seems like there is some overflow issue since thebackground repeats all the way to the edge of the border. Have you seen this before? Also more minor is that the dropshadow no longer appears. The sub-sub-nav problem is a deal-killer. I can't use Superfish unless I resolve that. Thank you. You guys have been great to us Superfish newbies. Sean On Feb 1, 8:56 am, levine@gmail.com levine@gmail.com wrote: Also, where do I find the font color for the menu? I have looked in the RM css files as well as the SF css files and can't seem to make out where it is. Thanks again, Ron On Feb 1, 7:59 am, levine@gmail.com levine@gmail.com wrote: Thanks for the heads up on turning off the call. However, I still don't have any idea of where to put the code that Joel is talking about. Does this go into the Rhuk_milkyway css file??? Regards, Ron On Feb 1, 2:22 am, bklyn2cali s...@mediajelly.com wrote: Joel, I've got this working now, thank you. One last issue: the SuperSubs plugin works only on the first sub-sub- nav. I'm not sure why.http://www.stcyril.net/site/ It seems like there is some overflow issue since thebackground repeats all the way to the edge of the border. I'm so close to getting this done, just this issue, and also more minor is that the dropshadow no longer appears. Thanks for your help. It is much appreciated. Sean On Jan 31, 6:08 am, Joel Birch joeldbi...@gmail.com wrote: Hello, This is the exact same issue someone else had just the other day, and they were also a Joomla user. Your problem is figure out by selecting the menu li element using Firebug. The Superfishbackgroundrule is being overridden by the #pillmenu li li rule which is in the green.css file. The reason this rule gets precedence over the Superfish CSS is because it uses an id in the selector, which trumps the .sf-menu class selector. Interestingly, 'pillmenu' was the exact same id that was involved with the other Joomla user's issue, so I assume it must be part of Joomla's templates. Solve your problem by adding the id to your Superfish selector in order to increase its 'specificity', like this: #pillmenu .sf-menu li {background: #BDD2FF url('../images/ normal_bg.png') repeat-x 0 0; } Joel Birch.
[jQuery] Re: [listnav] in Chrome
Hmm, I'm stumped on this one (I created the plugin). This is the line in the listnav plugin that causes Safari to bog down: $('a', $letters).click(function(){ If I put a console entry right after that: window.console.log(letter clicked); I can see that the delay is the click handler. IE, it takes 5-10 seconds until the console entry appears. I tried it using jquery 1.2.6 and 1.3.1 (which you had in the page), with similar results. Any jquery or jquery plugin contributors who might know why the click takes so long to respond? BTW, I also tried replacing that line with some event delegation code, so that a click on $letters is watched for, but I saw the same delay. Thoughts? Thanks, Jack simshaun wrote: Using jQuery 1.3.1, This question refers to the ListNav plugin found here: http://www.ihwy.com/Labs/jquery-listnav-plugin.aspx I've got a fairly large dataset on my page consisting of ~1000 LI elements. Each letter of the alphabet contains ~40 LI elements. Each LI element contains a varying amount of chars, but lets say ~70 chars. In FF3, it takes about 3-4 seconds for the plugin to index the list. In IE7, it takes about 1 second. In IE6, it takes about 1 second. In Safari 3.1 Google Chrome, it takes about 14 seconds. Why does it take so long in Safari 3.1 Google Chrome? URL for testing: http://www.simshaun.com/listnav.php
[jQuery] Re: Several questions regarding jQuery Approach...
Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Several questions regarding jQuery Approach...
Maybe because you are return reference to the function not a jQuery object: return this; Read this post: http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-extending.html It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Several questions regarding jQuery Approach...
But it does not even get to the return statement... On Feb 7, 12:47 am, jQuery Lover ilovejqu...@gmail.com wrote: Maybe because you are return reference to the function not a jQuery object: return this; Read this post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-... It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Text to the left of the jQuery Star Rating Plugin
Surround your text (Rating:) with div and give a float:right CSS... worked for me on plugins demo page... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 12:54 AM, Tom seil...@gmail.com wrote: Hi, I'm using the star rating plugin at: http://www.fyneworks.com/jquery/star-rating/ and I'm trying to add a little text to the left of a set of stars (i.e. Rating: * * * * * ). After fooling around with the CSS for a long time, I still haven't been able to get rid of the line break between the text and the stars (I get the visual equivalent of Rating: \n* * * * * ). I've tried floating things left, setting display: inline, etc, but I must be missing something. I'm using the current version at: http://code.google.com/p/jquery-star-rating-plugin/ Does anyone know how to do this? Much thanks, Tom
[jQuery] Re: Several questions regarding jQuery Approach...
But you are saying first time you run it, it gives you 'table', the second time you run it, it says it's not a table... This means, the first time it is getting to the return statement... Or did I get you wrong ? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:02 PM, ShurikAg shuri...@gmail.com wrote: But it does not even get to the return statement... On Feb 7, 12:47 am, jQuery Lover ilovejqu...@gmail.com wrote: Maybe because you are return reference to the function not a jQuery object: return this; Read this post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-... It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Several questions regarding jQuery Approach...
Sorry, I have probably didn't enplane myself properly. I'm running it once, but when I'm trying to track jQ (this).selector (by alert), it alerts me twice in the same run: once with table and second is empty... On Feb 7, 1:11 am, jQuery Lover ilovejqu...@gmail.com wrote: But you are saying first time you run it, it gives you 'table', the second time you run it, it says it's not a table... This means, the first time it is getting to the return statement... Or did I get you wrong ? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:02 PM, ShurikAg shuri...@gmail.com wrote: But it does not even get to the return statement... On Feb 7, 12:47 am, jQuery Lover ilovejqu...@gmail.com wrote: Maybe because you are return reference to the function not a jQuery object: return this; Read this post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-... It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Several questions regarding jQuery Approach...
And by the way: I tried to return jQ(this)... nothing changes. On Feb 7, 1:18 am, ShurikAg shuri...@gmail.com wrote: Sorry, I have probably didn't enplane myself properly. I'm running it once, but when I'm trying to track jQ (this).selector (by alert), it alerts me twice in the same run: once with table and second is empty... On Feb 7, 1:11 am, jQuery Lover ilovejqu...@gmail.com wrote: But you are saying first time you run it, it gives you 'table', the second time you run it, it says it's not a table... This means, the first time it is getting to the return statement... Or did I get you wrong ? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:02 PM, ShurikAg shuri...@gmail.com wrote: But it does not even get to the return statement... On Feb 7, 12:47 am, jQuery Lover ilovejqu...@gmail.com wrote: Maybe because you are return reference to the function not a jQuery object: return this; Read this post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-... It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: Several questions regarding jQuery Approach...
could you post your code with alert statements? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:19 PM, ShurikAg shuri...@gmail.com wrote: And by the way: I tried to return jQ(this)... nothing changes. On Feb 7, 1:18 am, ShurikAg shuri...@gmail.com wrote: Sorry, I have probably didn't enplane myself properly. I'm running it once, but when I'm trying to track jQ (this).selector (by alert), it alerts me twice in the same run: once with table and second is empty... On Feb 7, 1:11 am, jQuery Lover ilovejqu...@gmail.com wrote: But you are saying first time you run it, it gives you 'table', the second time you run it, it says it's not a table... This means, the first time it is getting to the return statement... Or did I get you wrong ? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:02 PM, ShurikAg shuri...@gmail.com wrote: But it does not even get to the return statement... On Feb 7, 12:47 am, jQuery Lover ilovejqu...@gmail.com wrote: Maybe because you are return reference to the function not a jQuery object: return this; Read this post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-... It explains why you need to return jQuery object. On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg shuri...@gmail.com wrote: Question related to the same plugin: Plugin code: jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table //alert(jQ(this).selector); if(!jQ(this).is('table')){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return this; }; and I'm running it as: var $table = $('table'); $table.table(); and I'm always getting: The element must be valid table element! I've tried to trace what the selector is; and once it is table but the second time (in he same run) is null. Why there are two entries to this function anyways? I have only one table on the page.
[jQuery] Re: thickbox 3.1 and new jquery 1.3.1 - please help
Try to delete @ on line 79. 79: TB_TempArray = $(a...@rel=+imageGroup+]).get(); 79: TB_TempArray = $(a[rel=+imageGroup+]).get(); Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:43 AM, newbie alanv...@gmail.com wrote: I upgraded from jquery 1.2.2 to 1.31 but thickbox 3.1 does not work. Any help is appreciated
[jQuery] Re: Several questions regarding jQuery Approach...
/** * */ (function(jQ) { /** * Default options */ var Defaults = { cols: 0, rows: 0, cssClass: null, //if not set will try to get it from the object itself //if titles on the first table raw is needed // thead: false, ajax: false, //if loaded by ajax //set to specific url from where the JSON object will be loaded. Makes an effect only if ajaxparam is true. //the default value is taken from loadUrl attribute of the table loadUrl: false, //is the table sortable; if needed set to list of column names to sort by sortable: false, preLoad: null, //function to run right before loading process onDataReceived: null, //callabck to run whenever the table data is received onDataError: null, //a callback, if error occures while data fetch postLoad: null //a callback that called when the JSON data load finished } /** * if the table was initialized */ var Initialized = false; var Selector = ; var Titles = { // id: title text col1: Column 1, col2: Column 2, col3: Column 3 }; var Data = new Object(); var Options = null; /** * Constructor */ jQ.fn.table = function(options, titles, data){ if(jQ(this).length == 0){ //try to find at least one element $.log(Matching element +jQ(this).selector+ was not found!) return null; } //validate that this element is unique i=on hte page if(jQ(this).length 1){ $.log(The element's selector must be unique on the page!); return null; } //check if the elemment is a table alert(jQ(this).selector); if(!jQ(this).is(table)){ $.log(The element must be valid table element!); return null; } /** * Save the selector for further */ Selector = jQ(this).selector; //extend defaults Options = jQ.extend({}, Defaults, options); //init additional data //init UI jQ.fn.table.initUI(); return jQ(this); }; /** * Set new set of titles. * If the table is empty the definition of titles will define the table from the scratch * if the number of columns is already defined, only those matching by id will be replaced. */ jQ.fn.table.SetTitles = function(tlsObj){ return $.each(tlsObj, function(id, val){ jQ(thead tr td#+id, this).text(val); }) }; jQ.fn.table.Clear = function(dataOnly){ if(dataOnly){ jQ(Selector+ :not('thead')).remove(); } else { jQ(this).remove(); } }; /** * initialize UI. create a first look of the table */ jQ.fn.table.initUI = function(){ if(Initialized){ return; } Options.cols = Object.size(Titles); c = 0; //set scc if needed if(Options.cssClass != || Options.cssClass != null){ jQ(this).addClass(Options.cssClass) } //deal with the thead if(Options.thead == true){ //need to wrap first row with thead } //fill in the thead var tHead = $(thead/thead); var tr = $(tr/tr) $.each(Titles, function(i, val){ $(td/td).attr({ id: i }).text(val).appendTo(tr); }); tHead.append(tr).prependTo(this); //Options.rows++; } // /** // * Cleans and polulates the whole entier table with data // */ // jQ.fn.TablePopulate = function(obj){ // //$.each // }; // // /** // * Adds data to the end of the table // */ // jQ.fn.TableAdd = function(obj){ // // }; })(jQuery); Here you go.
[jQuery] Re: Datepicker UI Opening at Random / Unexpected Locations
Yeap, a test page would help to find the bug... One more question. Are you positioning your elements in CSS using relative/absolute ? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 8:38 AM, Ca-Phun Ung cap...@yelotofu.com wrote: Hi, Which version of UI are you using? We recently fixed a similar bug which was rolled into 1.6rc6. For details of the bug see this ticket: http://dev.jqueryui.com/ticket/3863 Finally, if you're using the latest rc it would be a great help if you could upload a minimal test page somewhere. Thanks! On Fri, Feb 6, 2009 at 11:31 PM, Dayson Pais percy.p...@gmail.com wrote: Hi, I have a Datepicker UI linked to a textbox using the following code: $(document).ready(function(){ txtDOB = $(input[name=txtDOB]); txtDOB.datepicker(); }); Screenshot of the Textbox: http://arch.kimag.es/share/85588260.jpg When I click on the textbox, the calendar opens at an unexpected location as seen in this picture Firefox appears over textbox: http://arch.kimag.es/share/34288230.jpg Chrome Working Fine: http://arch.kimag.es/share/75291561.jpg It works fine in Chrome. I really can't figure out why this is happening.. It works perfectly if the textbox is placed in the top regions of the page. The Actual Problem in a practical situation is here: http://arch.kimag.es/share/66324568.jpg I need this resolved as I really don't want to use a calendar component from some other module if jquery has it. Thanks -- Ca-Phun Ung + http://yelotofu.com + hongkong, zce, jquery, php, css, html
[jQuery] Re: Several questions regarding jQuery Approach...
I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Disable a link temporarily
Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: Several questions regarding jQuery Approach...
But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] I can't get Shadowbox to fire!
Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page at http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: Several questions regarding jQuery Approach...
me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
instead of $.log() just put alert(); you will see the error. My html is something like this: ... table class=.tbl/table ... and I'm using it as: var $table = $('.tbl'); $table.table(); On Feb 7, 2:04 am, jQuery Lover ilovejqu...@gmail.com wrote: I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
That's what I did. I put console.log() (firebug console logging). And still not getting that message. Only alert that says table... Probably, you are using .table() function somewhere else on non table element ??? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:08 PM, ShurikAg shuri...@gmail.com wrote: instead of $.log() just put alert(); you will see the error. My html is something like this: ... table class=.tbl/table ... and I'm using it as: var $table = $('.tbl'); $table.table(); On Feb 7, 2:04 am, jQuery Lover ilovejqu...@gmail.com wrote: I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: I can't get Shadowbox to fire!
I'm getting No Shadowbox language loaded error message! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:54 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page at http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: Several questions regarding jQuery Approach...
I'm shocked!!! This is all I'm trying to do: var $table = $('.tbl'); $table.table(); $table.table.SetTitles({col1:test, col3: test3, col5: not exist}); Do you get the table titles ? On Feb 7, 2:16 am, jQuery Lover ilovejqu...@gmail.com wrote: That's what I did. I put console.log() (firebug console logging). And still not getting that message. Only alert that says table... Probably, you are using .table() function somewhere else on non table element ??? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:08 PM, ShurikAg shuri...@gmail.com wrote: instead of $.log() just put alert(); you will see the error. My html is something like this: ... table class=.tbl/table ... and I'm using it as: var $table = $('.tbl'); $table.table(); On Feb 7, 2:04 am, jQuery Lover ilovejqu...@gmail.com wrote: I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: How do I add/subtract currency with jquery?
You might find Masked Input plugin useful: http://digitalbush.com/projects/masked-input-plugin/ Also on creating your custom jQuery plugins: http://jquery-howto.blogspot.com/search/label/plugin On Sat, Feb 7, 2009 at 2:10 AM, webopolis krodenho...@gmail.com wrote: I've done this with straight Javascript for years, I just thought with all the other cool things that have been done with jquery, there would be a plugin for this as well. Thanks for the help. Kevin On Feb 6, 3:52 pm, sem101 semiotics...@gmail.com wrote: You don't need jQuery for math, it's simple JavaScript. But -- you can use jQuery to get elements of your forms var qty = parseInt($('input#qty').val()) || 0; var product1 = parseFloat($('input#product1').val()) || 0; var discount = parseFloat($('input#discount').val()) || 0; var grandtotal = (qty * product1) - discount; $(div#total).html('h1$' + grandtotal.toFixed(2) + '/h1'); This would roughly create variables to hold your form input values, then show the grandtotal in a div called #total. You can grasp the concept.The things to look up are Floating Point, Integers and Decimals, etc. http://www.w3schools.com/js/default.asp On Feb 6, 3:13 pm, webopolis krodenho...@gmail.com wrote: How do I add/subtract currency with jquery?- Hide quoted text - - Show quoted text -
[jQuery] Re: Several questions regarding jQuery Approach...
And how come this: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); ??? On Feb 7, 2:22 am, ShurikAg shuri...@gmail.com wrote: I'm shocked!!! This is all I'm trying to do: var $table = $('.tbl'); $table.table(); $table.table.SetTitles({col1:test, col3: test3, col5: not exist}); Do you get the table titles ? On Feb 7, 2:16 am, jQuery Lover ilovejqu...@gmail.com wrote: That's what I did. I put console.log() (firebug console logging). And still not getting that message. Only alert that says table... Probably, you are using .table() function somewhere else on non table element ??? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:08 PM, ShurikAg shuri...@gmail.com wrote: instead of $.log() just put alert(); you will see the error. My html is something like this: ... table class=.tbl/table ... and I'm using it as: var $table = $('.tbl'); $table.table(); On Feb 7, 2:04 am, jQuery Lover ilovejqu...@gmail.com wrote: I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: I can't get Shadowbox to fire!
That's strange - Firebug is not displaying any error messages here. I've turned on a load-the-language command - it's made no difference to my display - what about from your end? Cheers, Bruce At 11:20 p.m. 7/02/2009, you wrote: I'm getting No Shadowbox language loaded error message! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:54 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page at http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: Several questions regarding jQuery Approach...
The weird thing is that it worked perfectly well until I inserted the functions into table namespace... On Feb 7, 2:24 am, ShurikAg shuri...@gmail.com wrote: And how come this: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); ??? On Feb 7, 2:22 am, ShurikAg shuri...@gmail.com wrote: I'm shocked!!! This is all I'm trying to do: var $table = $('.tbl'); $table.table(); $table.table.SetTitles({col1:test, col3: test3, col5: not exist}); Do you get the table titles ? On Feb 7, 2:16 am, jQuery Lover ilovejqu...@gmail.com wrote: That's what I did. I put console.log() (firebug console logging). And still not getting that message. Only alert that says table... Probably, you are using .table() function somewhere else on non table element ??? Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:08 PM, ShurikAg shuri...@gmail.com wrote: instead of $.log() just put alert(); you will see the error. My html is something like this: ... table class=.tbl/table ... and I'm using it as: var $table = $('.tbl'); $table.table(); On Feb 7, 2:04 am, jQuery Lover ilovejqu...@gmail.com wrote: I don't have $.log() function so i just commented those lines out... but let me log them with console.log()... NOPE, I did not. I just got a table alert box and that's it... Just one alert box! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:59 PM, ShurikAg shuri...@gmail.com wrote: I'm getting this error when the lines bellow are called: jQ(this).addClass(Options.cssClass); ... tHead.append(tr).prependTo(this); On Feb 7, 1:56 am, ShurikAg shuri...@gmail.com wrote: me too and do you get The element must be valid table element!? On Feb 7, 1:53 am, jQuery Lover ilovejqu...@gmail.com wrote: FF3 Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:53 PM, ShurikAg shuri...@gmail.com wrote: hm which browser you are working with? On Feb 7, 1:49 am, jQuery Lover ilovejqu...@gmail.com wrote: But these lines should not cause 2 alerts... I just run you code and i'm getting just one alert box ?! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:45 PM, ShurikAg shuri...@gmail.com wrote: I figured out that the problem starts here: jQ(this).addClass(Options.cssClass); and here: tHead.append(tr).prependTo(this);
[jQuery] Re: Several questions regarding jQuery Approach...
I tried something: If I pass to initUI this, and using it as bellow: jQ.fn.table.initUI = function(obj){ if(Initialized){ //return; } Options.cols = Object.size(Titles); c = 0; //set scc if needed if(Options.cssClass != || Options.cssClass != null){ jQ(obj).addClass(Options.cssClass); } //deal with the thead if(Options.thead == true){ //need to wrap first row with thead } //fill in the thead var tHead = jQ(thead/thead); var tr = jQ(tr/tr); jQ.each(Titles, function(i, val){ jQ(td/td).attr({ id: i }).text(val).appendTo(tr); }); tHead.append(tr).prependTo(obj); //Options.rows++; } Works perfect. I have no explanation to that.
[jQuery] Re: Several questions regarding jQuery Approach...
I tried to debug the code and the second alert is fired when table.initUI() returns. It's probably how browsers work. When you call .table.initUI() it probably goes through the .table as well.. or something... sounds weird though :) Anyway, it's good you have resolved your problem :))) Good luck with the project... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:39 PM, ShurikAg shuri...@gmail.com wrote: I tried something: If I pass to initUI this, and using it as bellow: jQ.fn.table.initUI = function(obj){ if(Initialized){ //return; } Options.cols = Object.size(Titles); c = 0; //set scc if needed if(Options.cssClass != || Options.cssClass != null){ jQ(obj).addClass(Options.cssClass); } //deal with the thead if(Options.thead == true){ //need to wrap first row with thead } //fill in the thead var tHead = jQ(thead/thead); var tr = jQ(tr/tr); jQ.each(Titles, function(i, val){ jQ(td/td).attr({ id: i }).text(val).appendTo(tr); }); tHead.append(tr).prependTo(obj); //Options.rows++; } Works perfect. I have no explanation to that.
[jQuery] Re: Several questions regarding jQuery Approach...
By the way, for some reason, this: 1. you can acces them like this $('tr td', this).each(...); Also see does not work
[jQuery] Re: Several questions regarding jQuery Approach...
Thanks a lot. Last question, is it a good idea to pass the object just in order to stay in the same namespace? On Feb 7, 2:51 am, jQuery Lover ilovejqu...@gmail.com wrote: I tried to debug the code and the second alert is fired when table.initUI() returns. It's probably how browsers work. When you call .table.initUI() it probably goes through the .table as well.. or something... sounds weird though :) Anyway, it's good you have resolved your problem :))) Good luck with the project... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:39 PM, ShurikAg shuri...@gmail.com wrote: I tried something: If I pass to initUI this, and using it as bellow: jQ.fn.table.initUI = function(obj){ if(Initialized){ //return; } Options.cols = Object.size(Titles); c = 0; //set scc if needed if(Options.cssClass != || Options.cssClass != null){ jQ(obj).addClass(Options.cssClass); } //deal with the thead if(Options.thead == true){ //need to wrap first row with thead } //fill in the thead var tHead = jQ(thead/thead); var tr = jQ(tr/tr); jQ.each(Titles, function(i, val){ jQ(td/td).attr({ id: i }).text(val).appendTo(tr); }); tHead.append(tr).prependTo(obj); //Options.rows++; } Works perfect. I have no explanation to that.
[jQuery] Re: I can't get Shadowbox to fire!
Still getting the language error. Bruce, why don't you use some lighter lightbox plugins ??? http://www.google.com/search?q=jquery+lightbox+plugin Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:27 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: That's strange - Firebug is not displaying any error messages here. I've turned on a load-the-language command - it's made no difference to my display - what about from your end? Cheers, Bruce At 11:20 p.m. 7/02/2009, you wrote: I'm getting No Shadowbox language loaded error message! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:54 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page at http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: Several questions regarding jQuery Approach...
I think namespacing is always a good idea :) Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:57 PM, ShurikAg shuri...@gmail.com wrote: Thanks a lot. Last question, is it a good idea to pass the object just in order to stay in the same namespace? On Feb 7, 2:51 am, jQuery Lover ilovejqu...@gmail.com wrote: I tried to debug the code and the second alert is fired when table.initUI() returns. It's probably how browsers work. When you call .table.initUI() it probably goes through the .table as well.. or something... sounds weird though :) Anyway, it's good you have resolved your problem :))) Good luck with the project... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:39 PM, ShurikAg shuri...@gmail.com wrote: I tried something: If I pass to initUI this, and using it as bellow: jQ.fn.table.initUI = function(obj){ if(Initialized){ //return; } Options.cols = Object.size(Titles); c = 0; //set scc if needed if(Options.cssClass != || Options.cssClass != null){ jQ(obj).addClass(Options.cssClass); } //deal with the thead if(Options.thead == true){ //need to wrap first row with thead } //fill in the thead var tHead = jQ(thead/thead); var tr = jQ(tr/tr); jQ.each(Titles, function(i, val){ jQ(td/td).attr({ id: i }).text(val).appendTo(tr); }); tHead.append(tr).prependTo(obj); //Options.rows++; } Works perfect. I have no explanation to that.
[jQuery] Re: Disable a link temporarily
$('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM, rob303 rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: how to change the iframe src
Don't forget the space between iframe and id: $('#connectframe'+' iframe').attr(src, Why do you have a concatination there anyway ??? $('#connectframe iframe').attr(src, Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 4:08 AM, cindy ypu01...@yahoo.com wrote: I tried to use Richardo' method, it is still not working. SourceCOde: !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 meta content=text/html; charset=iso-8859-1 http-equiv=Content- Type/ titleRAP Console/title link type=text/css media=screen rel=stylesheet href=clilib/ mainpage.css script src=jscripts/wizard/jquery-1.2.3.pack.js type=text/ javascript/script /head script var refreshTime=3; var summaryTab=1; var connectTab=2; var diagTab=3; var isSummaryInit= true; var isConnectInit=false; var isDiagInit=false; var mode=protype; var currentTab=summaryTab; function clickTab( tabName) { if(tabName==currentTab) return; if(tabName==summaryTab) { $('#summaryframe'+'iframe').attr(src,http://www.google.com;); } else if(tabName==connectTab) { $('#connectframe'+'iframe').attr(src,http://www.yahoo.com;); } else if(tabName==diagTab) { $('#diagframe'+'iframe').attr(src,http://www.yelp.com;); } currentTab=tabName; }; $(document).ready(init); function init() { $('#Summary').bind('click',function(){clickTab(summaryTab)}); $('#Connectivity').bind('click',function(){clickTab(connectTab)}); $('#Diag').bind('click',function(){clickTab(diagTab)}); }; /script body div id=header div id=titleimg src=images/logo.gif/div div id=header_logoimg src=images/logo.gif/div /div div id=tab ul id=tab_ul class=up li id=SummarySummary/li li id=ConnectivityConnectivity/li li id=DiagDiagnostics/li /ul /div div id=global_content div id=statusConnection Status:/div div id=updateTime Last updated: 10:31:14 AM/div div id=refreshRefresh/div div id=gensupport Generate save support file/div /div div id=frame div id=summaryframe iframe width=100% height=100% frameborder=1/iframe /div div id=connectframe iframe width=100% height=100% frameborder=1/iframe /div div id=diagframe iframe width=100% height=100% frameborder=1/iframe /div /div /body /html On Feb 6, 2:48 pm, Ricardo Tomasi ricardob...@gmail.com wrote: $('connectframe'+'iframe') should be $('#connectframe'+' iframe') (notice the whitespace) and so on.. On Feb 6, 7:34 pm, cindy ypu01...@yahoo.com wrote: Hi, what I want to do is to change iframe src, when click the tab. The click function is called, but the iframe src is not changed at all. Do you know what is wrong? Cindy !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 meta content=text/html; charset=iso-8859-1 http-equiv=Content- Type/ titleRAP Console/title link type=text/css media=screen rel=stylesheet href=clilib/ mainpage.css script src=jscripts/wizard/jquery-1.2.3.pack.js type=text/ javascript/script /head script var refreshTime=3; var summaryTab=1; var connectTab=2; var diagTab=3; var isSummaryInit= true; var isConnectInit=false; var isDiagInit=false; var mode=protype; var currentTab=summaryTab; function clickTab( tabName) { if(tabName==currentTab) return; if(tabName==summaryTab) { $('summaryframe'+'iframe').attr(src,http://www.google.com;); setFocus('summaryframe'); } else if(tabName==connectTab) { $('connectframe'+'iframe').attr(src,http://www.yahoo.com;); setFocus('connectframe'); } else if(tabName==diagTab) { $('diagframe'+'iframe').attr(src,http://www.yelp.com;); setFocus('diagframe'); } currentTab=tabName; }; $(document).ready(init); function init() { $('#Summary').bind('click',function(){clickTab(summaryTab)}); $('#Connectivity').bind('click',function(){clickTab(connectTab)}); $('#Diag').bind('click',function(){clickTab(diagTab)}); }; /script body div id=header div id=titleimg src=images/alogo.gif/div
[jQuery] Re: live works in IE6?
File a ticket: http://dev.jquery.com Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:42 AM, Dhana sldh...@gmail.com wrote: Ok, an update, I put in a few alerts and looks like the event.target is returning the img tag for ie7 and Firefox and IE6 is returning an a tag. Just a little curious on this different event bubbling. Could someone clarify this if you have any ideas.
[jQuery] Re: Disable a link temporarily
Rather than bindin/unbinding events, why not put a hidden label (or tag of your choice) there with the same text, then toggle between them: $(a, label).toggle(); Show the anchor or show the label. On Feb 7, 6:07 am, jQuery Lover ilovejqu...@gmail.com wrote: $('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM, rob303 rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: How to enable jquery in a loaded page?
hmm, so i need to put all the javascript, i have in showContent.php's $ (document).ready(function () { in a callback function?? Can i leave the other js functions in showContent.php or should i copy those function into my base php file?? regards, On 6 feb, 15:33, ilovejquery ilovejqu...@gmail.com wrote: It's probably because your jquery code is in $(document).ready() function and it is never fired when you load with .load(). Put your code in callback function like this: $(document).ready(function() { $(#show).click(function() { $(#content).css(overflow-y, scroll); $(#content).load(showContent.php, function(){ // your code here... }); }); Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Feb 6, 2009 at 6:40 PM, 123gotoandplay wesweatyous...@gmail.com wrote: Hi there, I am having a problem to enable jquey in a loaded page. For example: base.php has jquery and i load showContent.php like: $(document).ready(function() { $(#show).click(function() { $(#content).css(overflow-y, scroll); $(#content).load(showContent.php); }); but now the jquery in showContent.php doesn't work. if i directly browse to showContent.php the jquery does work Any tips?
[jQuery] Selecting the params inside an object
Hi! I think this is a simple question but I somehow cannot solve it myself. I'd like to remove those new Youtube-Headings on a blog by adding 'showinfo=0' to the Youtube-URLs. It works absolutely fine with the embeds by doing this: $('embed').each(function(){ var newname = $(this).attr('src')+'showinfo=0'; $(this).attr('src',newname); }); Since the object-tag gets its parameters from the nested param I somehow don't manage to access these. How do I access the name-parameter of each object? Thanks! Frederik
[jQuery] Re: Selecting the params inside an object
Totally sorry! I messed up 'name' and 'value', so I tried to augment the 'name' of the param. No wonder it didn't work! Works absolutely fine with: $('param').each(function(){ var newname = $(this).attr('value')+'showinfo=0'; $(this).param('value',newname); }); Thanks!
[jQuery] Re: How to enable jquery in a loaded page?
ok i think i understand the callback. But what about showContent.php in a thickbox iframe ??? i am trying this without any look a href=showContent.php? action=addContentkeepThis=trueTB_iframe=trueheight=450width=550 class=thickbox again when i directly browse to showContent.php it works but with the thickbox class it doesn't??
[jQuery] jquery, ajax, and search engines
I've noticed when I fill in dynamic content on a page using jquery that when you view source you don't see the dynamic content. So I'm wondering if search engines don't see it as well. It's obviously a serious consideration. Thanks!
[jQuery] Re: I can't get Shadowbox to fire!
Hi Bruce, Your link http://horticulture127.massey.ac.nz/dumpthis.htm is full off errors... Microsoft JET Database Engine error... I have used shadowbox before, maybe I can help... if I you have a online example :) On Feb 7, 10:54 am, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page athttp://horticulture127.massey.ac.nz/dumpthis.htmand letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: I can't get Shadowbox to fire!
On Feb 7, 11:59 am, jQuery Lover ilovejqu...@gmail.com wrote: Still getting the language error. Bruce, why don't you use some lighter lightbox plugins ??? http://www.google.com/search?q=jquery+lightbox+plugin Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 3:27 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: That's strange - Firebug is not displaying any error messages here. I've turned on a load-the-language command - it's made no difference to my display - what about from your end? Cheers, Bruce At 11:20 p.m. 7/02/2009, you wrote: I'm getting No Shadowbox language loaded error message! Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:54 PM, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've tried a zillion combinations but I can't find the one that will make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire. I am running jQuery 1.3.1 and Shadowbox v2. Would someone mind checking out my test page at http://horticulture127.massey.ac.nz/dumpthis.htmand letting me know what I'd doing wrong. For example, clicking on the site hyperlink should bring up a Shadowbox containing an image - I just get a new page containing the image Thanks Bruce
[jQuery] Re: jquery, ajax, and search engines
Search engines don't see dynamic content. You can put some content in a noscript tag, and that will be visible to a search spider, and anybody who doesn't have javascript (enabled). On Feb 7, 7:06 am, jhm jmay...@gmail.com wrote: I've noticed when I fill in dynamic content on a page using jquery that when you view source you don't see the dynamic content. So I'm wondering if search engines don't see it as well. It's obviously a serious consideration. Thanks!
[jQuery] Re: jquery, ajax, and search engines
jhm ha scritto: So I'm wondering if search engines don't see it as well. It's obviously a serious consideration. No, they don't :-) You have to consider this writing an ajax application. IMHO using ajax for loading content it's not the right way to use this technology. Bye -- gianiaz.net - web solutions via angelo custode, 10 - 23100 sondrio (so) - italy +39 347 7196482
[jQuery] Re: All is well except in IE - links initially not clickable
Thank you so much Stephan! It seems to work fine now. Precar. On Feb 6, 3:16 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, looks like you are running into racing-conditions. Why are you creating your list elements and bind the click event handler in two different and ASYNCHRONOUS functions initial_list() and site_details() ? Add you site_details() functionality to your initial_list() function just before the scroll_pane() call. You can still encapsulate the functionality in a function, just call it directly (in a synchronously way). e.g. var initial_list=function(){ $.get('data.php.xml',function(data){ $(data).find('site').each(function(){ ... }) site_details(data); scroll_pane() return }) return} var site_details=function(data){ $('#sites ul li').bind('click',function(){ var index=$('#sites ul li').index(this) ... by(e) Stephan 2009/2/6 precar pranshua...@gmail.com: Thanks James. I actually had semicolons placed properly but after I ran the code through a JavaScript code cruncher online they were all removed. I suppose I could try putting them back in, although like you said, that's probably not the problem. On Feb 6, 1:43 pm, James james.gp@gmail.com wrote: This probably won't help much, but personally I think it's a good habit to put semi-colon (;) at the end of your lines in your JS code. It will help reduce possible errors. On Feb 6, 8:33 am, precar pranshua...@gmail.com wrote: I've tried using Firebug for debugging but since there's nothing technically wrong in the script, I can't get much out of it. Is there a way to use Firebug for debugging something that's not broken but isn't functioning like you want it to? On Feb 6, 11:27 am, precar pranshua...@gmail.com wrote: Could I get some help on this please? Thank you, Precar. On Jan 30, 8:52 am, precar pranshua...@gmail.com wrote: Hi, Yes, I'm using the bind() method with 'click'. Is that the correct approach? Precar. On Jan 28, 9:47 am, amuhlou amysch...@gmail.com wrote: It looks like it's not appending the selected class to the li onClick in IE7. Are you using the bind() method to apply the click functionality? On Jan 28, 10:34 am, precar pranshua...@gmail.com wrote: Hi, My site (http://pthesis.com) works fine in Firefox/Opera/Safari, but inIE7 there is a small hitch. Sometimes when I click the portfolio link and open it, the links to the sites in the left column aren't clickable. If I close it and re-open it, they work, and if I do Refine by category and then click, they work. As I mentioned, this only happens inIE7. I've tested inIE8 beta 2 and it works fine. Does anyone have any suggestions for a workaround? If it would be helpful I'll post the page code here, or you may view it directly from the site. Thanks for your help, Precar.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: traversing ajax response with .find in Safari/Chrome
like my original statement that works in IE and FF, but not Safari or Chrome. Strange On Feb 6, 11:17 pm, jQuery Lover ilovejqu...@gmail.com wrote: var newItem=$(div#item, response).html(); Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 9:02 AM, pedalpete p...@hearwhere.com wrote: I'm trying to get a div from an html ajax response. my code is pretty simple [code] success: function(response){ var newItem=$(response).find(div#item).html(); alert(newItem); } [/code] This works fine in FF and IE, but Chrome and Safari both return null. I'm trying to find another way to write that, but It all seems pretty straight forward to me. Is there another way to get this other than .find?
[jQuery] Re: treeview custom icon
This works fine for replacing the file image, but how can I replace the collapsable and expandable folder images? I would like to distinguish one folder from all other folders. Date: Thu, 5 Feb 2009 19:20:01 +0530 Subject: [jQuery] Re: treeview custom icon From: tareq.m...@gmail.com To: jquery-en@googlegroups.com Yes it is possible . suppose u have a tree [ A ] Branches are [ B,C,D ]then if u wana add icon on B branch , then give a id of B branch div $('#Bid').prepend('img src=... /'); hope this will help u. regardsRagx. On Thu, Feb 5, 2009 at 6:52 PM, viklund_anders viklund_and...@hotmail.com wrote: Hi I would like to have a custom icon for one specific entry in the tree, is this possible? Thanks! -- ---| Regard |--- Mohd.Tareque _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/photos.aspx
[jQuery] Re: UI/Tabs docs mismatch for multiple ul
The FAQ applies to UI 1.5. UI 1.6 requires slightly different markup (additional container) and works fine for me. --Klaus On 6 Feb., 22:32, Nathaniel Whiteinge whitei...@gmail.com wrote: The UI Tabs documentation for using ul in a panel [1] has conflicting info and I'm not sure how to proceed. I'd like the following, but links in the enclosed ul are overwritten as though they are tab links:: ul id=container lia href=#oneOne/a/li lia href=#twoTwo/a/li /ul div id=one ul.../ul /div div id=two ul.../ul /div The docs say to select the TOC ul specifically for .tabs() (which doesn't work and looks to have been removed in trunk [2]), but also say to target #container for tabs(). So how can I prevent tabifying links in the subsequent ul elements? Thanks. - whiteinge .. [1]http://docs.jquery.com/UI/Tabs#...the_call_to_tabs_tabify_all_li_elem... .. [2]http://dev.jqueryui.com/changeset/2020
[jQuery] Altered SWF not updating
Hello! I am using jQuery to alter the parameters of embedded YouTube-Videos. This works fine with browsers that use the embed portion of the code (Opera FF), whereas the browsers who use the object part (IE Chrome) will update the code accordingly but not refresh the Video. What I am using is the following: $(document).ready(function(){ $('param').each(function(){ var oldname = $(this).attr('value'); var check = oldname.search(/youtube.+/); if (check != -1){ var newname = oldname+'showinfo=0'; $(this).attr('value',newname); } }); $('embed').each(function(){ var oldname = $(this).attr('src'); var check = oldname.search(/youtube.+/); if (check != -1){ var newname = oldname+'showinfo=0'; $(this).attr('src',newname); } }); }); Anybody got any idea how to get the object-browsers to refreshing the display? Thanks!
[jQuery] Re: Text to the left of the jQuery Star Rating Plugin
Great, that did the trick on the simplified test version I was messing around on. For some reason it didn't work on my site, but I tried giving it a float: left !important instead and that worked. Thanks for the help, Tom On Feb 7, 4:10 am, jQuery Lover ilovejqu...@gmail.com wrote: Surround your text (Rating:) with div and give a float:right CSS... worked for me on plugins demo page... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 12:54 AM, Tom seil...@gmail.com wrote: Hi, I'm using thestarrating plugin at: http://www.fyneworks.com/jquery/star-rating/ and I'm trying to add a little text to theleftof a set of stars (i.e. Rating: * * * * * ). After fooling around with the CSS for a long time, I still haven't been able to get rid of the line break between the text and the stars (I get the visual equivalent of Rating: \n* * * * * ). I've tried floating thingsleft, setting display: inline, etc, but I must be missing something. I'm using the current version at: http://code.google.com/p/jquery-star-rating-plugin/ Does anyone know how to do this? Much thanks, Tom
[jQuery] Re: Newb question about accessing a form's inputs
Unless jQuery 1.3 has made vast improvement in the name=Xxx functionality, it is *horrendously slow*! I use a custom function to access form-fields - $F(fieldName) - which is up to 1000-times faster on large pages in my web-application. But this method is dependant on other custom methods, so I cannot provide it here as a stand-alone plug-in.. I wish/hope jQuery will soon provide an efficient way to access form- fields 'by name' because using IDs on form-fields is a clumsy hack that I refuse to use except in special cases. On complex, dynamically generated form pages, it clutters the code and requires extra logic to add sequential IDs to things like radio buttons. So this is not a proper solution to a common need. /Kevin On Feb 6, 2:27 pm, James james.gp@gmail.com wrote: Without using IDs, you can use: var myVar = $(input[name=myHiddenInput]).val(); On Feb 6, 10:54 am, james noahk...@gmail.com wrote: Hi, If I have a form: form name=myForm method=post action=myAction.php onsubmit=javascript:doStuff() input type=hidden name=myHiddenInput/ input type=text name=myNonHiddenText/ input type=submit value=submit /form What is the equivalent JQuery syntax for the following? function doStuff() { document.myForm.myHiddenInput.value = 'some dynamic var'; return true; } Thanks in advance, James- Hide quoted text - - Show quoted text -
[jQuery] Re: UI/Tabs docs mismatch for multiple ul
On Sat, Feb 7, 2009 at 11:54 AM, Klaus Hartl klaus.ha...@googlemail.comwrote: The FAQ applies to UI 1.5. In that case I moved it to the 1.5 FAQ, fyi http://docs.jquery.com/UI/API/1.5.3/Tabs#...the_call_to_tabs_tabify_all_li_elements_-_even_those_in_a_panel_-_although_I_did_not_want_to_create_nested_tabs.3F - Richard
[jQuery] jquery.ocupload-packed.js plugin hides my upload link?
somehow var myUpload = $('#upload_link').upload({ etc. hides my div#upload_link when i open it in a thickbox?? i am using the jquery.ocupload-packed.js plugin. Directly browsing to the file doesn't hide the div. What can i do???
[jQuery] Re: Optimize large DOM inserts
There's no need to use that function to insert the HTML, as the performance improvement comes mostly from emptying the element outside the DOM. To avoid the memory leak, you'd have to remove all the event listeners before destroying it - that's exactly what empty() does (+ clearing any data), and the source of most of it's overhead. You can probably get around that by not attaching any events to the inner elements and use event delegation on the table or live() instead. You might get away with something like this, not sure if it will perform any better: var c = $('#container')[0], parent = c.parentNode, next = c.nextSibling, old = parent.removeChild(c); c = old.cloneNode(false).innerHTML = out.join(''); if (next) next.insertBefore(c); else parent.appendChild(c); setTimeout(function(){ $(old).remove(); }, 200); //give the browser some breathing time then clean up eventsdata from the old element The cleaning up part will be unnecessary if you use event delegation. - ricardo On Feb 6, 9:17 pm, James james.gp@gmail.com wrote: I just noticed in IE6 that using the replaceHTML to clear the DOM with events attached definitely creates memory leak. FF seems to clean it up though. On Feb 6, 1:06 pm, James james.gp@gmail.com wrote: Wow! Wow! Wow! Using that replaceHTML function to empty out the element took practically no time at all! Though I wasn't able to get it to work properly in IE (tried only IE6) as oldEl.innerHTML = html; kept bombing on me with unknown runtime error. I've removed the IE-only part and let it run the rest. It's still many times faster than using $(el).empty(); However, I wasn't able to get replaceHTML to work on inserting HTML into the DOM though. Using the previous suggestions, it would become: replaceHtml('myElementID', out.join('')); but the inserted HTML in 'myElementID' had all of the HTML tags (tr, td, etc.) stripped out for some reason. On Feb 6, 11:48 am, Ricardo Tomasi ricardob...@gmail.com wrote: Now I might have something useful to say! :) I remember this being discussed long ago on the 'replaceHTML' subject. Apparently using .innerHTML on an element that is not in the DOM is much faster (except for IE which is already fast). See here: http://blog.stevenlevithan.com/archives/faster-than-innerhtmlhttp://w.. cheers, - ricardo On Feb 6, 6:28 pm, James james.gp@gmail.com wrote: Big thanks for the optimization! It certainly did optimize the loop processing by several folds! However, for my case, I found that the ultimate bottleneck was the plug-in function that I was using that froze the browser the longest. The actual insert to the DOM took a bit of time also and did freeze the browser, but wasn't too bad even in IE6. By the way, do you have any tips on emptying a large amount of content in the DOM? Such as emptying that whole chunk of HTML that was inserted. That also freezes the browser also. I'm currently using $(el).empty(); and not sure if there's a more optimal solution. Thanks! On Feb 5, 5:25 pm, Michael Geary m...@mg.to wrote: ...there is not much room for improvement left. You just know that when you say that, someone will come along with a 20x-40x improvement. ;-) http://mg.to/test/loop1.html http://mg.to/test/loop2.html Try them in IE, where the performance is the worst and matters the most. On my test machine, the first one runs about 6.3 seconds and the second one about 0.13 seconds. -Mike From: Ricardo Tomasi Concatenating into a string is already much faster than appending in each loop, there is not much room for improvement left. What you can do improve user experience though is split that into a recursive function over a setTimeout, so that the browser doesn't freeze and you can display a nice loading animation. On Feb 5, 5:03 pm, James james.gp@gmail.com wrote: I need tips on optimizing a large DOM insert to lessen the freeze on the browser. Scenario: I receive a large amount of JSON 'data' through AJAX from a database (sorted the way I want viewed), and loop through them to add to a JS string, and insert that chunk of string into a tbody of a table. Then, I run a plug-in that formats the table (with pagination, etc.). Simplified sample code: var html = ''; $.each(data, function(i, row) { html += 'trtddata from json/td/tr';}); $(tbody).append(html); $(table).formatTable(); formatTable() requires that the table has to be completed before it can be executed. Is there any way I can optimize this better? I think I've read somewhere that making a string too long is not good, but I've also read that updating the DOM on each iteration is even
[jQuery] Re: Optimize large DOM inserts
These test pages DO NOT accurately compare the speed of array.join() VS string+= The biggest speed difference between the two is REALLY that one uses $(table/table) and one doesn't. If this is removed from the 'slow' page, the load-speed goes from 8.7 sec to 1.5 sec. This is still 6-times longer than the fast version - but no longer 30-times longer! Conversely, I changed the 'fast' page to use the append syntax (after removing table and tbody from the array): $('#container').append( $('table/table').append( out.join('') ) ); This changed the 'fast' load from 0.24 sec to 7.3 sec! So even the 'fast loop' page performed 30-times slower when the element-append method is used! There was another code difference as well - the fast page uses $ ('#container').html() and the slow-page $('#container').append(). However, since the container is empty, it does not cause any significant speed difference. So for a TRUE loop-speed comparison, the code for the 'slow version' should be: var html = 'tabletbody'; $.each( rows, function( iRow, row ) { html += 'trtd' + row.text + '/td/tr'; }); html += '/tbody/table'; $('#container').html( html ); This now uses the same html() syntax as the fast version, isolating the difference between the pages to ONLY the 2 loops. Now there is less than a 1.3 sec difference - instead of 8+ seconds. Now it becomes clear that the biggest lesson here is that append (table/table) is a much bigger problem than the loop code. This is important to know because it would apply even if there were NO loop at all! Thanks for bringing both these details to my attention. I do a lot of dynamic HTML generation, so it's helpful to know what to watch out for. /Kevin On Feb 5, 7:25 pm, Michael Geary m...@mg.to wrote: ...there is not much room for improvement left. You just know that when you say that, someone will come along with a 20x-40x improvement. ;-) http://mg.to/test/loop1.html http://mg.to/test/loop2.html Try them in IE, where the performance is the worst and matters the most. On my test machine, the first one runs about 6.3 seconds and the second one about 0.13 seconds. -Mike From: Ricardo Tomasi Concatenating into a string is already much faster than appending in each loop, there is not much room for improvement left. What you can do improve user experience though is split that into a recursive function over a setTimeout, so that the browser doesn't freeze and you can display a nice loading animation. On Feb 5, 5:03 pm, James james.gp@gmail.com wrote: I need tips on optimizing a large DOM insert to lessen the freeze on the browser. Scenario: I receive a large amount of JSON 'data' through AJAX from a database (sorted the way I want viewed), and loop through them to add to a JS string, and insert that chunk of string into a tbody of a table. Then, I run a plug-in that formats the table (with pagination, etc.). Simplified sample code: var html = ''; $.each(data, function(i, row) { html += 'trtddata from json/td/tr';}); $(tbody).append(html); $(table).formatTable(); formatTable() requires that the table has to be completed before it can be executed. Is there any way I can optimize this better? I think I've read somewhere that making a string too long is not good, but I've also read that updating the DOM on each iteration is even worst. Any advice would be appreciated!- Hide quoted text - - Show quoted text -
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
IE 7 seems to be ok now, but there's a CSS bug I can't figure out (see the width of list items, it collapses to the width of the text they contain) I figured out how to make it work on IE6 (mostly), but as the changes are very specific I did not include them in the code. If anyone requires ie6 support just ask. Chrome is also ok. I also added some more data on the api. On Feb 6, 10:55 pm, Rick Faircloth r...@whitestonemedia.com wrote: Malformed in IE 7... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Friday, February 06, 2009 1:33 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) v0.6a is out http://www.nicolas.rudas.info/jQuery/Finder/ Following up on Nikola's idea, I've also made this: http://www.nicolas.rudas.info/jQuery/Finder/v0.6a/api.html The jQuery API, finder style. It's doesn't give any API docs tho at the moment, just a list of methods (the json data provided by jquery are a bit messy and a bit of a hussle to translate to html)
[jQuery] Re: How to enable jquery in a loaded page?
Ide ais to start excecution when ontents in loaded. So you should put only your ently point call there. Other functions/vars etc may be anywhere. Best regards, Konstantin Mirin mailto:konstantin.mi...@gmail.com mailto:i...@konstantin.takeforce.net -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of 123gotoandplay Sent: Saturday, February 07, 2009 1:39 PM To: jQuery (English) Subject: [jQuery] Re: How to enable jquery in a loaded page? hmm, so i need to put all the javascript, i have in showContent.php's $ (document).ready(function () { in a callback function?? Can i leave the other js functions in showContent.php or should i copy those function into my base php file?? regards, On 6 feb, 15:33, ilovejquery ilovejqu...@gmail.com wrote: It's probably because your jquery code is in $(document).ready() function and it is never fired when you load with .load(). Put your code in callback function like this: $(document).ready(function() { $(#show).click(function() { $(#content).css(overflow-y, scroll); $(#content).load(showContent.php, function(){ // your code here... }); }); Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Feb 6, 2009 at 6:40 PM, 123gotoandplay wesweatyous...@gmail.com wrote: Hi there, I am having a problem to enable jquey in a loaded page. For example: base.php has jquery and i load showContent.php like: $(document).ready(function() { $(#show).click(function() { $(#content).css(overflow-y, scroll); $(#content).load(showContent.php); }); but now the jquery in showContent.php doesn't work. if i directly browse to showContent.php the jquery does work Any tips?
[jQuery] simple checkbox and display text problem
Hi all, having trouble getting each checkbox selected to display a text element. This works below, but of course i want it for all checkboxes and not just one $(document).ready(function() { var total = 0; var a = 0; //morning is the name of one the checkboxes $(inp...@name=morning]).click(function(){ if ($(this).is(:checked)) //if check assign value and append to span, else uncheck remove { $('#newsletters').append('span id=newsletter_types/span');// create span var a = 500; total = a; $('#newsletter_types').append(total + '.00'); } else $(#newsletter_types).remove(); }); }); This isn't working for me. $(document).ready(function() { var total = 0; $(inp...@type=checkbox]:checked).each(function(){ // read that each is like for loop count = $(inp...@type='checkbox']:checked).length; //get how many checked total = count * 500; $('#newsletters').append('span id=newsletter_types/ span'); //create span $('#newsletter_types').append(total + '.00'); }): }); Any hints is greatly appreciated. Thanks!
[jQuery] Multi using application
*Need to access Orkut and Face book under one application??? * * * *It's very easy you can access both under one umbrella... U just need to login to this page that will take u to access both Orkut and face book and also My space.* * * * * *http://www.power.com/invite/1/14106213* * * *Hope this might helpful to you guys J* ** ** *http://www.zhakkas.com/affiliates/performance+tracking+code/353.php* ** ** *Many Thanks.* *[?]* inline: 349.gif
[jQuery] dynamically inserted droppable
Hi, I am relatively new to developing applications with both javascript and the jquery framework. What I can't figure out is what to do if I dynamically insert something on my page (imagine I click on a button to create a new div-container) and that div should then automatically become a droppable or something. Right now, I have the following code loaded on the top of my site. This is not working when I dynamically load the div but of course is when I manually add that markup to the page. $('.usergroup').droppable({ accept: function(draggable) { // imagine certain logic that will return true }, drop: function(event, ui) { // do something... } }); $('#newgroup').live('click', function() { $('div class=usergroupnew user group/div').appendTo ('#container_usergroups').css('display', 'none').fadeIn('slow'); }); How can I make that div actually be droppable / whatever I want it to be? Thanks, Christian
[jQuery] Re: How to enable jquery in a loaded page?
Well, you have a space in your link. Maybe that's a problem. Should be: a href=showContent.php?action=addContentkeepThis=trueTB_iframe=trueheight= 450width=550 class=thickbox But I'm not sure I understanf what are you trying to get in the result. Yout thickbox class in link has nothing to do with the ajax query. Or you're using some extension that posts class also? Best regards, Konstantin Mirin mailto:konstantin.mi...@gmail.com mailto:i...@konstantin.takeforce.net -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of 123gotoandplay Sent: Saturday, February 07, 2009 3:25 PM To: jQuery (English) Subject: [jQuery] Re: How to enable jquery in a loaded page? ok i think i understand the callback. But what about showContent.php in a thickbox iframe ??? i am trying this without any look a href=showContent.php? action=addContentkeepThis=trueTB_iframe=trueheight=450width=550 class=thickbox again when i directly browse to showContent.php it works but with the thickbox class it doesn't??
[jQuery] Re: jQuery query string implementation
FYI I just uploaded a plugin (http://plugins.jquery.com/project/ parseQuery) that's pretty small (449 bytes minified); it parses the querystring into an object. On Feb 5, 6:53 am, jQuery Lover ilovejqu...@gmail.com wrote: Agree, that would be something useful... but it's better to have it as a plugin, since you don't need it for the most of the time... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Thu, Feb 5, 2009 at 7:44 PM, Matt Gardner lo...@newmethods.org wrote: John and crew, was curious for your opinion related to storing query string variables in an array (and perhaps expanding to capture key/value pairs beyond the # as well). Something worthwhile to have in the core? http://stackoverflow.com/questions/439463/how-to-get-get-and-post-var... -- Matt
[jQuery] Re: HELP, how to catch these elements ?
Try this $('table.cbFieldsContentsTab, div.tab-content') If you use Firefox, I recommend Firbug extension which haves a console so you can that try live. Very usefull. Greetings, Rodolfo. 2009/2/6 Ayan ios...@gmail.com Hello, I need a help to catch these HTML elements - Elements - table class=cbFieldsContentsTab cbFields id=cbtf_46/table table class=cbFieldsContentsTab cbFields id=cbtf_2/table table class=cbFieldsContentsTab cbFields id=cbtf_21/table table class=cbFieldsContentsTab cbFields id=cbtf_11/table table class=cbFieldsContentsTab cbFields id=cbtf_20/table div class=tab-content cb_tab_content cb_tab_tab_main id=cb_tabid_40/div div class=tab-content cb_tab_content cb_tab_tab_main id=cb_tabid_24/div What will be the statement ? $
[jQuery] how do I invoke a cluetip from code?
I just want to fire up a cluetip just like an Alert(). e.g pseudo code: if(!condition){ cluetip(try again!) } thanks in advance
[jQuery] Block UI problem
Hello, I'm having problems with BlockUI plugin. For some reason it applies style=poistion: relative; to parent div and this mess up with my contextMenu plugin. Is there any way to disable this? Thanks Rodolfo.
[jQuery] Re: Several questions regarding jQuery Approach...
Passing a table object to AJAX may be not the best idea :) You should normally mass data to the server, not data+presentation. Passing anything to $.ajax is just setting additional option in the data opbect parameter: $.ajax({ data:{ var1:'val1', table:$('#table') //--- here it goes } url:'your/script.php', .. } ); Best regards, Konstantin Mirin mailto:konstantin.mi...@gmail.com mailto:i...@konstantin.takeforce.net -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jQuery Lover Sent: Saturday, February 07, 2009 9:14 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Several questions regarding jQuery Approach... 1. you can acces them like this $('tr td', this).each(...); Also see here for custom plugins and functions: http://jquery-howto.blogspot.com/search/label/plugin 2. when you use $('table') you'll get a selection of all tables. If you do this you would get the same object instance: var $table = $('table'); $table.table(); $table.TableSetTitles({col1:test, col3: test3, col5: notexist}); 3. if a function takes an argument pass it a $table as parameter ... (give us a concrete example, and we could give a proper answer to this question...) Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 10:22 AM, ShurikAg shuri...@gmail.com wrote: Hi, 1. Assume that there is a table on a page: table tr td/td td/td /tr /table and I'm using jQuery to manipulate this table by: $(table).table(); What is the right way of accessing td elements inside the function: (function(jQ) { jQ.fn.table = function(options, titles, data){ ... ... } })(jQuery); 2. When I'm accessing the same table outside of plugin, like this: $(table).table(); $(table).TableSetTitles({col1:test, col3: test3, col5: not exist}); Do I actually accessing the same object instance? If not, what is the right way of doing it? 3. If I need to use additional jQuery object (.ajax for instance) by passing the table object to it; what is the right way of doing it? Thank you in advance.
[jQuery] Re: HELP, how to catch these elements ?
Here another methods: If you have more elements than those you can add .find(:contains('cbtf_46'), :contains('cbtf_2') ... ) or you could select them by their ids $(' #first_id, #second_id, , #last_id') Rodolfo. 2009/2/6 Rodolfo Allan rodolfo.al...@gmail.com Try this $('table.cbFieldsContentsTab, div.tab-content') If you use Firefox, I recommend Firbug extension which haves a console so you can that try live. Very usefull. Greetings, Rodolfo. 2009/2/6 Ayan ios...@gmail.com Hello, I need a help to catch these HTML elements - Elements - table class=cbFieldsContentsTab cbFields id=cbtf_46/table table class=cbFieldsContentsTab cbFields id=cbtf_2/table table class=cbFieldsContentsTab cbFields id=cbtf_21/table table class=cbFieldsContentsTab cbFields id=cbtf_11/table table class=cbFieldsContentsTab cbFields id=cbtf_20/table div class=tab-content cb_tab_content cb_tab_tab_main id=cb_tabid_40/div div class=tab-content cb_tab_content cb_tab_tab_main id=cb_tabid_24/div What will be the statement ? $
[jQuery] Issue with jQuery text scroller ...
This is the jQuery text scroller script(s) I'm using (http:// sorgalla.com/projects/jcarousel/examples/special_textscroller.html). I have this implemented on my site here: http://sites.fcps.org/testad/ The problem is that the script is set up to feed in content via XML/ Atom feed and i just want to feed in static content from my Web site. So I just want to post content using my Drupal site nodes and then mark up the content so it displays correctly in the text scroller. How can I tweak the script so it just works with static content? Is this possible? -backdrifting
[jQuery] Re: Block UI problem
I'm having problems with BlockUI plugin. For some reason it applies style=poistion: relative; to parent div and this mess up with my contextMenu plugin. Is there any way to disable this? It only does that if the element currently has 'static' position and no, there is no way to disable it. The element being blocked needs to have a non-static position so that the blocking elements can be positioned within. Mike
[jQuery] Re: how do I invoke a cluetip from code?
Hmm. If you have a link or some element that would fire up the cluetip normally, you can trigger the event that is set to invoke it: $('yourelement').triggerHandler('mouseover'); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 7, 2009, at 6:02 AM, frank6000 wrote: I just want to fire up a cluetip just like an Alert(). e.g pseudo code: if(!condition){ cluetip(try again!) } thanks in advance
[jQuery] Re: live works in IE6?
could be a number of things. do you have a test page up somewhere that we can look at? --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 6, 2009, at 5:19 PM, Dhana wrote: On a project I am currently working on, I decided to test out the new live function. The function works fine in IE 7 and Firefox, but the event is not even triggered in IE6. Any ideas why this is happening?
[jQuery] Re: live works in IE6?
File a ticket:http://dev.jquery.com Before doing that, post a sample here. A lot of bugs are not bugs.
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
Hi, Nicolas...looking good in IE7 now. Question: Does jQuery Finder read directories and display the contents dynamically? I'm looking for something that will do that... Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Saturday, February 07, 2009 2:04 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) IE 7 seems to be ok now, but there's a CSS bug I can't figure out (see the width of list items, it collapses to the width of the text they contain) I figured out how to make it work on IE6 (mostly), but as the changes are very specific I did not include them in the code. If anyone requires ie6 support just ask. Chrome is also ok. I also added some more data on the api. On Feb 6, 10:55 pm, Rick Faircloth r...@whitestonemedia.com wrote: Malformed in IE 7... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Friday, February 06, 2009 1:33 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) v0.6a is out http://www.nicolas.rudas.info/jQuery/Finder/ Following up on Nikola's idea, I've also made this: http://www.nicolas.rudas.info/jQuery/Finder/v0.6a/api.html The jQuery API, finder style. It's doesn't give any API docs tho at the moment, just a list of methods (the json data provided by jquery are a bit messy and a bit of a hussle to translate to html)
[jQuery] Re: Optimize large DOM inserts
No need to shout. :-) I never claimed that these pages reflect only the difference between the array join and string concatenation. On the contrary, in my other message in this thread I listed all of the factors that make the code faster: * Explicit for loop (and the fastest kind of for loop) - no function callback for each row. * Builds an array of string fragments and then joins it, instead of string concatenation. * Builds the array with out[++o] = ... instead of the more obvious out.push(...) (faster in IE). * Instead of inserting a large number of sibling DOM elements (the TRs) together, inserts only a single DOM element (the TABLE). Now it is very useful to know how much of the performance improvement is due to each of these individual tricks, and thank you for doing that testing. My purpose in posting was to combine all of the optimizations to create the fastest possible code. -Mike From: Kevin Dalman These test pages DO NOT accurately compare the speed of array.join() VS string+= The biggest speed difference between the two is REALLY that one uses $(table/table) and one doesn't. If this is removed from the 'slow' page, the load-speed goes from 8.7 sec to 1.5 sec. This is still 6-times longer than the fast version - but no longer 30-times longer! Conversely, I changed the 'fast' page to use the append syntax (after removing table and tbody from the array): $('#container').append( $('table/table').append( out.join('') ) ); This changed the 'fast' load from 0.24 sec to 7.3 sec! So even the 'fast loop' page performed 30-times slower when the element-append method is used! There was another code difference as well - the fast page uses $ ('#container').html() and the slow-page $('#container').append(). However, since the container is empty, it does not cause any significant speed difference. So for a TRUE loop-speed comparison, the code for the 'slow version' should be: var html = 'tabletbody'; $.each( rows, function( iRow, row ) { html += 'trtd' + row.text + '/td/tr'; }); html += '/tbody/table'; $('#container').html( html ); This now uses the same html() syntax as the fast version, isolating the difference between the pages to ONLY the 2 loops. Now there is less than a 1.3 sec difference - instead of 8+ seconds. Now it becomes clear that the biggest lesson here is that append (table/table) is a much bigger problem than the loop code. This is important to know because it would apply even if there were NO loop at all! Thanks for bringing both these details to my attention. I do a lot of dynamic HTML generation, so it's helpful to know what to watch out for. /Kevin On Feb 5, 7:25 pm, Michael Geary m...@mg.to wrote: ...there is not much room for improvement left. You just know that when you say that, someone will come along with a 20x-40x improvement. ;-) http://mg.to/test/loop1.html http://mg.to/test/loop2.html Try them in IE, where the performance is the worst and matters the most. On my test machine, the first one runs about 6.3 seconds and the second one about 0.13 seconds. -Mike From: Ricardo Tomasi Concatenating into a string is already much faster than appending in each loop, there is not much room for improvement left. What you can do improve user experience though is split that into a recursive function over a setTimeout, so that the browser doesn't freeze and you can display a nice loading animation. On Feb 5, 5:03 pm, James james.gp@gmail.com wrote: I need tips on optimizing a large DOM insert to lessen the freeze on the browser. Scenario: I receive a large amount of JSON 'data' through AJAX from a database (sorted the way I want viewed), and loop through them to add to a JS string, and insert that chunk of string into a tbody of a table. Then, I run a plug-in that formats the table (with pagination, etc.). Simplified sample code: var html = ''; $.each(data, function(i, row) { html += 'trtddata from json/td/tr';}); $(tbody).append(html); $(table).formatTable(); formatTable() requires that the table has to be completed before it can be executed. Is there any way I can optimize this better? I think I've read somewhere that making a string too long is not good, but I've also read that updating the DOM on each iteration is even worst. Any advice would be appreciated!- Hide quoted text - - Show quoted text -
[jQuery] Re: Can JQuery solve the iframe height=100% problem?
Hi Dave, You've probably long-since moved on from this, but I stumbled across this topic again, so thought I'd answer anyway... There are lots of examples on the Layout website for creating a 'layout' around an iframe - use one of these as a starting point... http://layout.jquery-dev.net/demos/frames.html http://layout.jquery-dev.net/samples/iframe_south.html Or use ANY demos as a starting point and just drop in your iframe: http://layout.jquery-dev.net/demos.html The UI/Layout website itself uses iframes for some pages so it can wrap content from other sites, like: http://layout.jquery-dev.net/discuss.html Rather than use the iframe itself as a layout 'pane', you could also put the iframe 'inside' a regular pane-div. Since the pane-div has a width and height set, all you need is: iframe width=100% height=100% ... This will auto-size the iframe to fit within the inner-dimensions of the pane - ie, inside the padding. The Layout widget provides virtually unlimited options for auto-sizing iframes and wrapping other content around it - like headers, footers, sidebars, etc. If you want to use Layout, then first check out the website documentation. If you need more assistance, use the dedicated discussion group... http://layout.jquery-dev.net/discuss.html HOWEVER, a page-layout may not be suitable to your needs because it a 'Javascript' solution, so users MUST have JS enabled or else your page will not look as you want. So depending on your need, you may find a pure CSS solutions preferable, even if it is does require some ugly nesting. Hope that helps. /Kevin On Jan 28, 11:39 am, laredotorn...@zipmail.com laredotorn...@zipmail.com wrote: Hi Kevin, I really appreciate your help with all this. Unfortunately, I added what you had suggested ... script type=text/javascript $(document).ready(function() { $(body).layout({ closable: false , resizable: false , spacing_open: 0 , center_paneSelector: #fileTreeIframe }); }); /script iframe id=fileTreeIframe class=ui-layout-center style=border:0px none #ff; src=file_tree.php border=0 width=100% scroll=auto/iframe and even included the normal script instaed of the .min.js file ... script type=text/javascript src=../scripts/jquery.layout.js/ script but sadly still now luck (screen shot is as before). There are no JS errors on the page. Do I have to give every element on my page a class name like you mention above, or should it be enough to only name the iframe? Thanks, - Dave
[jQuery] Re: Can JQuery solve the iframe height=100% problem?
If you are going to apply a specific iframe height via script... $('#myIframe').css({height:$(this).parent('td').height()}); ...You MUST bind an event to window.resize to *re-size* the iframe whenever the browser window is resized. /Kevin On Jan 30, 10:58 am, jquertil til...@gmail.com wrote: I think you're going down the wrong path - you shouldnt need to script anything to get a CSS attribute to work. usually when I run into this problem it is because somewhere in my document tree there is a parent lement that has no height attribute set. So if you have html someDiv anotherDiv table tr td iframe every one of the elements should have a parent with height set At least this is how I usually end up solving the dreaded height 100% problem whenever I come to it. Alternatively, you can try $('#myIframe').css({height:$(this).parent('td').height()});
[jQuery] Re: simple checkbox and display text problem
Bob, Not sure exactly what you're trying to do here. You might wish to elaborate more. However, I can already tell you that you're going to have issues with putting out multiple spans with the same id. You should use a class or some other attribute to store the identification information. Aaron On Fri, Feb 6, 2009 at 5:50 PM, coworkerbob tribe...@gmail.com wrote: Hi all, having trouble getting each checkbox selected to display a text element. This works below, but of course i want it for all checkboxes and not just one $(document).ready(function() { var total = 0; var a = 0; //morning is the name of one the checkboxes $(inp...@name=morning]).click(function(){ if ($(this).is(:checked)) //if check assign value and append to span, else uncheck remove { $('#newsletters').append('span id=newsletter_types/span');// create span var a = 500; total = a; $('#newsletter_types').append(total + '.00'); } else $(#newsletter_types).remove(); }); }); This isn't working for me. $(document).ready(function() { var total = 0; $(inp...@type=checkbox]:checked).each(function(){ // read that each is like for loop count = $(inp...@type='checkbox']:checked).length; //get how many checked total = count * 500; $('#newsletters').append('span id=newsletter_types/ span'); //create span $('#newsletter_types').append(total + '.00'); }): }); Any hints is greatly appreciated. Thanks!
[jQuery] Re: Optimize large DOM inserts
Rick, first you need to arrange your HTML to allow you to insert the entire table element in one fell swoop. IOW, put the table inside another container element that has nothing else in it, e.g. div id=scheduleContainer ... table and children will be inserted here ... /div Then your code might look something like: function populateDutyTable(response) { var currentDay = ''; var rows = response.QGETDUTYSCHEDULE.DATA; var out = [], o = -1; out[++o] = 'table id=scheduleBody'; for( var row, i = -1; row = rows[++i]; ) { var day = row[1]; if( currentDay != day ) { currentDay = day; out[++o] = 'trtd class=cell-day'; out[++o] = row[1]; out[++o] = '/tdtd class=cell-date'; out[++o] = row[2]; out[++o] = '/tdtd class=cell-blank colspan=5nbsp;/td/tr'; } out[++o] = 'trtd class=cell-blank-daynbsp;/tdtd class=cell-blank-datenbsp;/tdtd class=cell-am-am'; out[++o] = row[3]; out[++o] = '/tdtd class=cell-position'; out[++o] = row[4]; out[++o] = '/tdtd colspan=3Cell Content/td/tr'; } out[++o] = '/table'; $('#scheduleContainer').html( out.join('') ); } In addition to the other optimizations I mentioned in my earlier message, I also combined consecutive string constants into one. You may prefer to keep them separate for readability and maintainability, at a slight cost in speed. -Mike From: Rick Faircloth Hi, Mike, et al... I'm having the same problem loading the DOM with a lot of generated HTML and I'm very interested in your approach to generating the code. I looked over the example you have at ...loop2.html and have tried to modify it, but I'm afraid there's too much I don't understand. My code works, but it's slow when loading the DOM making the browser to freeze and I'm afraid that will confuse the user. If it's not too much trouble, would you consider modifying my code below to follow your pattern so I can see if it speeds up loading my DOM? I would appreciate it very much, if you have the time or interest. Rick Here's my table building code: function populateDutyTable(response) { //First, empty table body of data $('#scheduleBody').empty(); currentDay = ; //For each row within the query $.each(response.QGETDUTYSCHEDULE.DATA, function(i, row) { if (currentDay != row[1]) { //Define a variable that will hold the html string var myRow1 = 'tr'; currentDay = row[1]; myRow1 += 'td class=cell-day' + row[1] + '/td'; myRow1 += 'td class=cell-date' + row[2] + '/td'; myRow1 += 'td class=cell-blank colspan=5nbsp;/td'; myRow1 += '/tr'; $('#scheduleBody').append(myRow1); } var myRow2 = 'tr'; myRow2 += 'td class=cell-blank-daynbsp;/td'; myRow2 += 'td class=cell-blank-datenbsp;/td'; myRow2 += 'td class=cell-am-am' + row[3] + '/td'; myRow2 += 'td class=cell-position' + row[4] + '/td'; myRow2 += 'td colspan=3Cell Content/td'; myRow2 += '/tr'; //Append row with names to the body of the table $('#scheduleBody').append(myRow2); }); } And here's what you coded: $(function() { var rows = []; for( var i = 0; i 2000; ++i ) { rows[i] = { text: ''+i }; } var t1 = + new Date; function loadTable( rows ) { var out = [], o = -1; out[++o] = 'tabletbody'; for( var row, iRow = -1; row = rows[++iRow]; ) { out[++o] = 'trtd'; out[++o] = row.text; out[++o] = '/td/tr'; } out[++o] = '/tbody/table'; $('#container').html( out.join('') ); } loadTable( rows ); var t2 = + new Date; alert( ( t2 - t1 ) / 1000 + ' seconds' ); }); -Original Message- From: jquery-en@googlegroups.com
[jQuery] Re: Optimize large DOM inserts
Mike, sorry if my post sounded like criticism - it was not intended that way. However the representation of the test pages is misleading - by accident I'm sure. The majority of the performance difference between the 2 pages is *solely* the difference between these 2 syntax $(#container).append( $(table/table).append( trtdHello/td/tr ) ); $(#container).append( tabletrtdHello/td/tr/table ); Or alternately... $(#container).html( tabletrtdHello/td/tr/table ); The syntax differences above are responsible for 85% of the speed difference between the pages - 7-times more than the loop-optimization is. Yet none of the points you repeated above are related to this issue. BOTH syntax only do a single DOM append - they just do it differently. And the 'loop' is irrelevant to this 85% difference - a simple string will still produce the same result. If you replace the code in your 'slow page' with the sample I gave in my last post - using .html( html ) - you'll see that the speed improves 7-fold -- with no change to the string-concatenation loop or anything else. Since this is 85% of the speed difference, this is proper way to comparison of the issues you raised. (You could also use $(table/table) in BOTH pages, but then the 'fast page' takes over 7 seconds!) So the loop-optimization produces only a 6-times speed improvement in IE - not 30-times. This.is still a significant improvement by itself, but I think it important to understand that $(table/table) is *really* the big culprit here. In fact, I think this is something that should be brought to the jQuery team's attention... Why is this syntax so slower? Ciao, /Kevin On Feb 7, 1:41 pm, Michael Geary m...@mg.to wrote: No need to shout. :-) I never claimed that these pages reflect only the difference between the array join and string concatenation. On the contrary, in my other message in this thread I listed all of the factors that make the code faster: * Explicit for loop (and the fastest kind of for loop) - no function callback for each row. * Builds an array of string fragments and then joins it, instead of string concatenation. * Builds the array with out[++o] = ... instead of the more obvious out.push(...) (faster in IE). * Instead of inserting a large number of sibling DOM elements (the TRs) together, inserts only a single DOM element (the TABLE). Now it is very useful to know how much of the performance improvement is due to each of these individual tricks, and thank you for doing that testing. My purpose in posting was to combine all of the optimizations to create the fastest possible code. -Mike From: Kevin Dalman These test pages DO NOT accurately compare the speed of array.join() VS string+= The biggest speed difference between the two is REALLY that one uses $(table/table) and one doesn't. If this is removed from the 'slow' page, the load-speed goes from 8.7 sec to 1.5 sec. This is still 6-times longer than the fast version - but no longer 30-times longer! Conversely, I changed the 'fast' page to use the append syntax (after removing table and tbody from the array): $('#container').append( $('table/table').append( out.join('') ) ); This changed the 'fast' load from 0.24 sec to 7.3 sec! So even the 'fast loop' page performed 30-times slower when the element-append method is used! There was another code difference as well - the fast page uses $ ('#container').html() and the slow-page $('#container').append(). However, since the container is empty, it does not cause any significant speed difference. So for a TRUE loop-speed comparison, the code for the 'slow version' should be: var html = 'tabletbody'; $.each( rows, function( iRow, row ) { html += 'trtd' + row.text + '/td/tr'; }); html += '/tbody/table'; $('#container').html( html ); This now uses the same html() syntax as the fast version, isolating the difference between the pages to ONLY the 2 loops. Now there is less than a 1.3 sec difference - instead of 8+ seconds. Now it becomes clear that the biggest lesson here is that append (table/table) is a much bigger problem than the loop code. This is important to know because it would apply even if there were NO loop at all! Thanks for bringing both these details to my attention. I do a lot of dynamic HTML generation, so it's helpful to know what to watch out for. /Kevin On Feb 5, 7:25 pm, Michael Geary m...@mg.to wrote: ...there is not much room for improvement left. You just know that when you say that, someone will come along with a 20x-40x improvement. ;-) http://mg.to/test/loop1.html http://mg.to/test/loop2.html Try them in IE, where the performance is the worst and matters the most. On my test machine, the first one runs about 6.3 seconds and the second one about 0.13 seconds. -Mike From: Ricardo Tomasi Concatenating into a string is already much faster than
[jQuery] Re: simple checkbox and display text problem
Thanks Aaron, I kinda figured that out when I found that things worked fine except when both checkboxes are checked and you uncheck one, my script breaks. I just wanted to use jquery to show the price of a course when its checkbox is checked. i've already solved the server side with java. I guess I have to go back to the drawing board before even writing code. $(document).ready( function() { var total = 0; $(inp...@type=checkbox]).click(function(){ if ($(this).is(:checked)) { $(#newsletter_types).remove(); $('#newsletters').append('span id=newsletter_types/span');//create span first count = $(inp...@type='checkbox']:checked).length; total = 500 * count; $('#newsletter_types').append(total + '.00'); } else $(#newsletter_types).remove(); }); }); On Sat, Feb 7, 2009 at 2:08 PM, Aaron Gundel aaron.gun...@gmail.com wrote: Bob, Not sure exactly what you're trying to do here. You might wish to elaborate more. However, I can already tell you that you're going to have issues with putting out multiple spans with the same id. You should use a class or some other attribute to store the identification information. Aaron On Fri, Feb 6, 2009 at 5:50 PM, coworkerbob tribe...@gmail.com wrote: Hi all, having trouble getting each checkbox selected to display a text element. This works below, but of course i want it for all checkboxes and not just one $(document).ready(function() { var total = 0; var a = 0; //morning is the name of one the checkboxes $(inp...@name=morning]).click(function(){ if ($(this).is(:checked)) //if check assign value and append to span, else uncheck remove { $('#newsletters').append('span id=newsletter_types/span');// create span var a = 500; total = a; $('#newsletter_types').append(total + '.00'); } else $(#newsletter_types).remove(); }); }); This isn't working for me. $(document).ready(function() { var total = 0; $(inp...@type=checkbox]:checked).each(function(){ // read that each is like for loop count = $(inp...@type='checkbox']:checked).length; //get how many checked total = count * 500; $('#newsletters').append('span id=newsletter_types/ span'); //create span $('#newsletter_types').append(total + '.00'); }): }); Any hints is greatly appreciated. Thanks!
[jQuery] Re: Optimize large DOM inserts
Hey, thanks Michael for taking the time to provide the explanation and the re-write. I'll put this into place and see how it performs. I'm sure it'll be *much* better! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Michael Geary Sent: Saturday, February 07, 2009 5:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Optimize large DOM inserts Rick, first you need to arrange your HTML to allow you to insert the entire table element in one fell swoop. IOW, put the table inside another container element that has nothing else in it, e.g. div id=scheduleContainer ... table and children will be inserted here ... /div Then your code might look something like: function populateDutyTable(response) { var currentDay = ''; var rows = response.QGETDUTYSCHEDULE.DATA; var out = [], o = -1; out[++o] = 'table id=scheduleBody'; for( var row, i = -1; row = rows[++i]; ) { var day = row[1]; if( currentDay != day ) { currentDay = day; out[++o] = 'trtd class=cell-day'; out[++o] = row[1]; out[++o] = '/tdtd class=cell-date'; out[++o] = row[2]; out[++o] = '/tdtd class=cell-blank colspan=5nbsp;/td/tr'; } out[++o] = 'trtd class=cell-blank-daynbsp;/tdtd class=cell-blank-datenbsp;/tdtd class=cell-am-am'; out[++o] = row[3]; out[++o] = '/tdtd class=cell-position'; out[++o] = row[4]; out[++o] = '/tdtd colspan=3Cell Content/td/tr'; } out[++o] = '/table'; $('#scheduleContainer').html( out.join('') ); } In addition to the other optimizations I mentioned in my earlier message, I also combined consecutive string constants into one. You may prefer to keep them separate for readability and maintainability, at a slight cost in speed. -Mike From: Rick Faircloth Hi, Mike, et al... I'm having the same problem loading the DOM with a lot of generated HTML and I'm very interested in your approach to generating the code. I looked over the example you have at ...loop2.html and have tried to modify it, but I'm afraid there's too much I don't understand. My code works, but it's slow when loading the DOM making the browser to freeze and I'm afraid that will confuse the user. If it's not too much trouble, would you consider modifying my code below to follow your pattern so I can see if it speeds up loading my DOM? I would appreciate it very much, if you have the time or interest. Rick Here's my table building code: function populateDutyTable(response) { //First, empty table body of data $('#scheduleBody').empty(); currentDay = ; //For each row within the query $.each(response.QGETDUTYSCHEDULE.DATA, function(i, row) { if (currentDay != row[1]) { //Define a variable that will hold the html string var myRow1 = 'tr'; currentDay = row[1]; myRow1 += 'td class=cell-day' + row[1] + '/td'; myRow1 += 'td class=cell-date' + row[2] + '/td'; myRow1 += 'td class=cell-blank colspan=5nbsp;/td'; myRow1 += '/tr'; $('#scheduleBody').append(myRow1); } var myRow2 = 'tr'; myRow2 += 'td class=cell-blank-daynbsp;/td'; myRow2 += 'td class=cell-blank-datenbsp;/td'; myRow2 += 'td class=cell-am-am' + row[3] + '/td'; myRow2 += 'td class=cell-position' + row[4] + '/td'; myRow2 += 'td colspan=3Cell Content/td'; myRow2 += '/tr'; //Append row with names to the body of the table $('#scheduleBody').append(myRow2); }); } And here's what you coded: $(function() { var rows = []; for( var i = 0; i 2000; ++i ) { rows[i] = { text: ''+i }; } var t1 = + new Date; function loadTable( rows ) { var out = [], o = -1; out[++o] = 'tabletbody'; for( var row, iRow = -1; row = rows[++iRow]; ) { out[++o] = 'trtd'; out[++o] = row.text; out[++o] = '/td/tr'; } out[++o] = '/tbody/table'; $('#container').html( out.join('') );
[jQuery] Re: UI/Tabs docs mismatch for multiple ul
On Feb 7, 9:54 am, Klaus Hartl klaus.ha...@googlemail.com wrote: The FAQ applies to UI 1.5. UI 1.6 requires slightly different markup (additional container) and works fine for me. Yes, I'm using 1.5.3 (the current release) and it does not work. Are you saying this is not possible with 1.5 and I need to run the preview release instead?
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
Rick, this might do the trick for you: jQuery file tree http://abeautifulsite.net/notebook/58 - Jack Rick Faircloth wrote: Hi, Nicolas...looking good in IE7 now. Question: Does jQuery Finder read directories and display the contents dynamically? I'm looking for something that will do that... Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Saturday, February 07, 2009 2:04 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) IE 7 seems to be ok now, but there's a CSS bug I can't figure out (see the width of list items, it collapses to the width of the text they contain) I figured out how to make it work on IE6 (mostly), but as the changes are very specific I did not include them in the code. If anyone requires ie6 support just ask. Chrome is also ok. I also added some more data on the api. On Feb 6, 10:55 pm, Rick Faircloth r...@whitestonemedia.com wrote: Malformed in IE 7... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Friday, February 06, 2009 1:33 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) v0.6a is out http://www.nicolas.rudas.info/jQuery/Finder/ Following up on Nikola's idea, I've also made this: http://www.nicolas.rudas.info/jQuery/Finder/v0.6a/api.html The jQuery API, finder style. It's doesn't give any API docs tho at the moment, just a list of methods (the json data provided by jquery are a bit messy and a bit of a hussle to translate to html)
[jQuery] Accordians in Tabs works correctly on IE but not Firefox
Accordians in Tabs works correctly on IE but not Firefox http://mynichecomputing.org/testpage/ Help would be appreciated
[jQuery] Finding specific values within an element
Hi there. I just started to play around with jQuery. I'm hoping you could take a look at this and see if I'm at the right track, or that my approach is completely wrong. The idea is simple. I have a bunch of entries I want to display. When I click an entry, I'd like jQuery to retrieve the entry's ID and do something with this ID. What I did is the following. HTML div class=entrySomething herespan class=entryId12345/span/ div div class=entrySomething herespan class=entryId67890/span/ div The span is hidden, so the actual entry ID won't show up in the HTML. So now I can make a list with all my entries, each with a unique entryId value within the class. SCRIPT $(document).ready(function(){ $('.entry').click(function() { entryId = $(this).find('span.entryId').text(); alert(entryId); }); }); Whenever I click on an element with class entry, the function will look for the element entryId within that class, and gets the entryId using text(). Is this the right way to do this? Or is there an easier/better way? I was hoping for something like this: HTML div id=entry;12345something here/div div id=entry;67890something else/div SCRIPT that does: search for an element that starts with #entry; and then explode on ';' to find the entryId. Thanks in advance for any help or pointers!
[jQuery] jQuery UI: Something that works correctly on IE but not firefox
jQuery UI: Something that works correctly on IE but not firefox : http://mynichecomputing.org/testpage/ Help.
[jQuery] How to save this context in callbacks
Goodday! Could anyone tell me how to save this context inside callback? Here is simple example: var myClass = jQuery.Class.create({ init: function(){ this.value = value; // callback as argument: someExternalFunction( function() { this.setValue(); // PROBLEM: this is not myClass pointer anymore! } ); }, setValue: function () { this.title = new value; } });
[jQuery] Does it hurt to call functions that don't do anything on the page?
So I have my document.ready function, looks something like this: $(document).ready(function(){ ManageCategoriesClick(); HideByDefault(); PrepareSplitForm(); SetUpAdvertPopup(); CheckAll(); CheckNone(); EditCategoryInPlace(); PreparePaneLinks(); PrepareToolTips(); }); Those functions all call things, but many are for specific pages. Does it slow the page down if they don't find the elements the functions call? What's the best way to call functions that are specific to a single page? -beau
[jQuery] Help : Difficulty binding event to selected jQuery object
Dear jQuery, Can find plenty of discussion on the use of livequery but little on binding problems which are less dynamic. If you could point out a nice simple thing I'm overlooking then that would be great :) Background: As part of a UI I'm coding I serve a series of working panes. Content is ajaxed into the pane and then livequeries pick out class flags from the loaded content. One such flag is toolbar_button class which signals to lift the element out and make it into a button on the toolbar. Post relocation, toolbar html's something like: ==\/ div class=toolbar div class=toolbar_buttonSave/div div class=toolbar_button Cancel/div div class=kill/div /div ==/\ Along with the toolbar_button class flag, a second flag can be used which clones the function of the button to a new button on the toolbar (for stuff that has to be in place in the html to function - in this case form buttons). These two types of toolbar button creation are dealt with by the following jQuery: ==\/ $(.toolbar_button).livequery(function(){ p=parent_pane($(this)); // Finds the parent pane of the button so it can be added to the correct toolbar if($(this).hasClass('copy_me')){// If the page element needs to stay in position, copy it to toolbar p.children('.toolbar').prepend(div class='toolbar_button' id='toolbar_button_target'+$(this).val()+/div); $(.toolbar_button_target).css('color','red').click(function(e){ alert('This code is never run!'); }).removeClass('toolbar_button_target'); }else{ // Move it to the toolbar p.children('.toolbar').prepend($(this).remove()); } }); ==/\ Buttons without the copy_me class are successfully transposed and function as they should. However, when adding a copy of a copy_me button the resulting object can be selected (the css() rule in the code above turns it red) but doesn't respond to event binding. Click() function as above doesn't work, nor other events. I can't find any complication with event bubbling, nothing is stopping the propagation. I would be much obliged if someone with a greater insight could point me right on this one. Thanks, James
[jQuery] Re: UI/Tabs docs mismatch for multiple ul
Yes, I'm using 1.5.3 (the current release) and it does not work. Are you saying this is not possible with 1.5 and I need to run the preview release instead? No, it's absolutely possible. Otherwise there wouldn't be a FAQ ;-) If you follow the code example in here it'll should work fine. --Klaus
[jQuery] Re: How to save this context in callbacks
Assign this to a local variable. function blah() { var blahThis = this; someExternalFunction( function() { blahThis.doSomething(); } } Karl Rudd On Sun, Feb 8, 2009 at 9:28 AM, Alexander kayuch...@gmail.com wrote: Goodday! Could anyone tell me how to save this context inside callback? Here is simple example: var myClass = jQuery.Class.create({ init: function(){ this.value = value; // callback as argument: someExternalFunction( function() { this.setValue(); // PROBLEM: this is not myClass pointer anymore! } ); }, setValue: function () { this.title = new value; } });
[jQuery] Re: How to save this context in callbacks
Sorry, cut and paste error there. Corrected: function blah() { var blahThis = this; someExternalFunction( function() { blahThis.doSomething(); }); } Karl Rudd On Sun, Feb 8, 2009 at 12:03 PM, Karl Rudd karl.r...@gmail.com wrote: Assign this to a local variable. function blah() { var blahThis = this; someExternalFunction( function() { blahThis.doSomething(); } } Karl Rudd On Sun, Feb 8, 2009 at 9:28 AM, Alexander kayuch...@gmail.com wrote: Goodday! Could anyone tell me how to save this context inside callback? Here is simple example: var myClass = jQuery.Class.create({ init: function(){ this.value = value; // callback as argument: someExternalFunction( function() { this.setValue(); // PROBLEM: this is not myClass pointer anymore! } ); }, setValue: function () { this.title = new value; } });
[jQuery] Re: How to save this context in callbacks
I still like the rescope function. :) http://groups.google.com/group/jquery-en/browse_thread/thread/43644231b5764f12?q=rescope+jquery#ca1b1069580a3f25 On Sat, Feb 7, 2009 at 8:03 PM, Karl Rudd karl.r...@gmail.com wrote: Assign this to a local variable. function blah() { var blahThis = this; someExternalFunction( function() { blahThis.doSomething(); } } Karl Rudd On Sun, Feb 8, 2009 at 9:28 AM, Alexander kayuch...@gmail.com wrote: Goodday! Could anyone tell me how to save this context inside callback? Here is simple example: var myClass = jQuery.Class.create({ init: function(){ this.value = value; // callback as argument: someExternalFunction( function() { this.setValue(); // PROBLEM: this is not myClass pointer anymore! } ); }, setValue: function () { this.title = new value; } });
[jQuery] Re: Finding specific values within an element
On Feb 8, 12:06 am, Alec sen...@gmail.com wrote: Is this the right way to do this? Or is there an easier/better way? I was hoping for something like this: HTML div id=entry;12345something here/div div id=entry;67890something else/div SCRIPT that does: search for an element that starts with #entry; and then explode on ';' to find the entryId. Posting my problems always gives me new ideas 5 minutes later :) I changed it to this: HTML div class=entry id=id-12345something here/div SCRIPT to get the ID number: $(this).attr('id').substr(3) (The id- part is for XHTML validation; I simply remove it with the substr() function.) I guess this is already much cleaner than the previous code.
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
That looks perfect! Thanks for the tip, Jack! Rick From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jack Killpatrick Sent: Saturday, February 07, 2009 7:19 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) Rick, this might do the trick for you: jQuery file tree http://abeautifulsite.net/notebook/58 - Jack Rick Faircloth wrote: Hi, Nicolas...looking good in IE7 now. Question: Does jQuery Finder read directories and display the contents dynamically? I'm looking for something that will do that... Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Saturday, February 07, 2009 2:04 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) IE 7 seems to be ok now, but there's a CSS bug I can't figure out (see the width of list items, it collapses to the width of the text they contain) I figured out how to make it work on IE6 (mostly), but as the changes are very specific I did not include them in the code. If anyone requires ie6 support just ask. Chrome is also ok. I also added some more data on the api. On Feb 6, 10:55 pm, Rick Faircloth mailto:r...@whitestonemedia.com r...@whitestonemedia.com wrote: Malformed in IE 7... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nicolas R Sent: Friday, February 06, 2009 1:33 PM To: jQuery (English) Subject: [jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns) v0.6a is out http://www.nicolas.rudas.info/jQuery/Finder/ Following up on Nikola's idea, I've also made this: http://www.nicolas.rudas.info/jQuery/Finder/v0.6a/api.html The jQuery API, finder style. It's doesn't give any API docs tho at the moment, just a list of methods (the json data provided by jquery are a bit messy and a bit of a hussle to translate to html)