[jQuery] Re: Help me!: $(this) ???
Probably changing $("tr #button").click(function(){... to this $("tr #button").click(function(){ $("select", this).html("012345"); return false; }); Will fix it. You need to find the select element in the right context, remember that jQuery's selectors work like CSS. Also I would write your code like this (you don't need to rewrite all the options just to select one, and you're not setting the option's values): $(document).ready(function(){ $("select").empty().append( new Option(0), new Option(1), new Option(2) ); $(".myButtons").click(function(){ $(this).find('select').val(1); //this will select the option with value == 1 }); }); >From the code your posted one can assume you have multiple elements with the "button" ID. That's invalid (IDs should be unique) and will certainly cause you trouble, use class="something" instead. cheers, - ricardo On Feb 23, 9:30 pm, Jsudesign wrote: > Hi everyone, > > I have an add button set up and when you click it it changes the > selected input from 0 to 1. > Where my problem is...is that it's doing this for every product. > > Here's an example:http://rickyscentralcitymall.com/ordering/tables.html > > I would add a new class to each product, but that's going to be a pain > in the end because there are 100+ items on the menu. > > Here's the code I'm working with currently. > > $(document).ready(function(){ > $("select").html("012 option>345"); > $("tr #button").click(function(){ > $("select").html("0 selected='selected'>1 option>234 option>5"); > return false; > }); > > }); > > Any help with this would be great. > > Best, > Justin
[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)
On Feb 25, 4:12 pm, ricardobeat wrote: > have you seen raphaeljs.com? Just having a look at this now. Seems like it might boil down to either using this, or going Java Applet with a library like http://www.jgraph.com/jgraph.html
[jQuery] Re: Calling method on multiple jQuery objects
$('#id') .add(myJQObj) .add(myotherJQObj) .hide() On Feb 24, 8:51 am, Bisbo wrote: > Hi there, > > I can't seem to find a way to perform the same jQuery method on > multiple jQuery objects. I have tried using commas and passing arrays > to the jQuery function but neither works. > > $( $('#id') , myJQObj ).hide(); > $( [ $('#id') , myJQObj ] ).hide(); > > I know you can do this within a selector, i.e. $('#id, .hello').hide > (), but I already have a few jQuery objects passed from various places > and I need to perform the same action on each of them. > > There must be a way to do this, can anyone point me in the right > direction as I can't see any way of doing this in the documentation! > > Many thanks, > > Michael
[jQuery] Re: listnav related - DL
So, the presence of the DD is what makes it difficult?
[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)
Java applets have a bit slow loading time, and afaik it can't interact with the rest of the page. Using iecanvas.js you would have to write a single code (compliant with the canvas specs) that would work for both IE and FF - but the support in IE might not be complete. have you seen raphaeljs.com? cheers, - ricardo On Feb 23, 7:47 pm, greghauptmann wrote: > still getting a bit confused with options here, can I ask: > > • re "iecanvas.js" - is there a way to effectively include this in > one's project then only write one (1) set of code (javascript, or > jquery or whatever) such that it will work both on (a) IE and (b) > firefox? > > • if no, then perhaps at this stage the most solid approach for a > browser based view of my topology tree would be to use a Java applet. > comments? > > thanks
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
On Feb 24, 6:10 pm, Jon Sagotsky wrote: > Just to clarify, $("p", "#foo") would be meaningless That's not true. $('p', '#foo') has the exact same result as $('p', $ ('#foo')), the context is executed just as well.
[jQuery] Re: failing miserably in IE
Turns out their was a newer version of the plugin which I downloaded and have now loaded up to the site. From what i can understand, that version uses the proper format you referred to. However, i am still getting the errors on jquery.min.js and main.js (which is google maps api). On Feb 24, 4:58 pm, pedalpete wrote: > Thanks MorningZ, > > strange that that is not the error I'm getting at all. > My errors have pointed a break in the jquery.1.3.1.min.js (which > seemed odd). > > I completely removed the references to dynacloud, but still get the > jquery and google maps errors. > > I've got the debugging on in IE, that's how i'm seeing the errors. > > I actually tried to fix the plugin to work with noconflict, (before > you saw it), but even with the link you sent, i am somewhat lost on > how to do that. > > I'll load up another version later today, but I'm finding this very > puzzling (and i actually had the problem before noconclict was turned > on. > > On Feb 24, 2:29 pm, MorningZ wrote: > > > In times like this, turning on Script Debugging in IE is very helpful > > (tools/options/advanced/uncheck-"disable script debugging") > > > pulling up the link above with debugging on pointed out the problem > > right away: > > > "Error: '$' is null or not an object" > > for the line > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > > looking at the code in "dynaCloud.js" > > > -- > > jQuery.fn.dynaCloud = function() { > > return this.each(function() { > > //var now = new Date().getTime(); > > > var cl = []; > > var max = 2000; > > var min = 10 > > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > var count = $.dynaCloud.max == -1 ? 50 : $.dynaCloud.max; > > -- > > > he didn't follow this convention > > >http://www.learningjquery.com/2007/10/a-plugin-development-pattern > > (scroll down to 'Keep private functions private', which makes sure > > that the code can use "$" even if "noConflict" is specified) > > > fix up that plugin script and you should be all good > > > On Feb 24, 4:56 pm,pedalpete wrote: > > > > So I got a version up and running, obviously you'll see by looking > > > this that it isn't a complete work, but if fails completely in IE, but > > > works in FF & Chrome. > > > >http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ > > > > I've picked it apart and put it back together, and it seems I just > > > keep ending up with different errors as I get deeper and deeper into > > > it, and the errors that are getting reported are with google maps, or > > > the the datePicker, or genre cloud. any ajax requests, etc. > > > Really any non-core (with the exception of ajax) function just doesn't > > > work. > > > > Any ideas on how to track this down would be greatly appreciated.
[jQuery] Rich text Editor
Hi, I am trying richtext editor the problem is on every button click (Like Bold or Code) how to send the tags([b][/b] or [code][/code]) to the last mouse or courser point in the textarea Thanks and regards, Anjith
[jQuery] Re: SimpleModal container and closing image
Ron, It sounds like the CSS just isn't pointing to the right place. Do you have a link I can view? -Eric On Feb 23, 4:27 pm, Ron wrote: > Hi, > > I'm using the SimpleModal library to display help text in a modal > popup. We are using the a.closeimg in the stylesheet to display a > modified X to close the window. > > The stylesheet is external and located in the web application > directory. It has a page to the image that takes into account the > server path eccentricities of ASP. > > The trouble is that in Firefox the image does not display and there > doesn't appear anywhere to click to close the window. The user has to > click the back button to get back to the screen. > > In IE, the mouse pointer shows there is a link to click to close the > window but the image does not appear. I've checked my path several > times and it seems to be okay--it should be loading the image. > > Anyone have any ideas what I'm doing wrong? > > Thanks, > > Ron
[jQuery] Re: How to find a div's which have background-img?
I have hundred or css class need that, I am afraid that it's better to search which has the property. On 2月25日, 下午12時18分, Steven Yang wrote: > according to your case > use$(".box") > or > $("div .box") > since all elements with class "box" will have background image
[jQuery] Re: How to find a div's which have background-img?
according to your case use$(".box") or $("div .box") since all elements with class "box" will have background image
[jQuery] Re: Is this a valid selector?
I think I see what's going on now... I have a div with the class of "section" at the bottom of the page which is surrounded by another div that has a style of "display:none;". That confuses the browsers. If I also set the div with the class of "section" to "display:none" while it is inside the div that also has style of "display:none" then the browsers act normally. Whew...that was driving me crazy! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Karl Rudd Sent: Tuesday, February 24, 2009 9:49 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Is this a valid selector? Apologies for the last post, I clicked send before I was ready. Check to see that the 'div.section:last' selector actually returns a valid jQuery object. (So check that $('div.section:last').length > 0) Karl Rudd On Wed, Feb 25, 2009 at 1:40 PM, Rick Faircloth wrote: > (‘div.section:last’) ??? > > > > I’m trying to use it in this code: > > > > $(document).ready(function() { > > > > $(‘#add-section’).livequery(‘click’, function() { > > $.scrollTo(‘div.section:last’, 1000); > > }); > > > > }); > > > > FF3 does nothing with it…IE7 scrolls close to the top > > of the page, rather than to towards the bottom > > where the ‘last div with class=section’ has been created. > > > > Ideas on how to make this work, anyone? > > > > Thanks, > > > > Rick
[jQuery] How to find a div's which have background-img?
for example .box { background-image: url(images/png_back.png); } Can I filter the div which have backround-image?
[jQuery] Re: Is this a valid selector?
I set up a test page locally, too, and the selector does work. Something elsewhere in my code is making this malfunction. Got some digging to do... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Rick Faircloth Sent: Tuesday, February 24, 2009 10:25 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Is this a valid selector? Thanks for the reply, Karl. I ran this code: $(document).ready(function() { $(‘#add-section’).livequery(‘click’, function() { $.scrollTo(‘div.section:last’, 1000); if ( $('div.section:last').length > 0 ) { alert('yes'); } else { alert('no'); }; }); }); I get a 'yes' alert every time. Just can't figure out why this isn't working. There are no div's with the class of 'section' near the top of the page at all... Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Karl Rudd Sent: Tuesday, February 24, 2009 9:49 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Is this a valid selector? Apologies for the last post, I clicked send before I was ready. Check to see that the 'div.section:last' selector actually returns a valid jQuery object. (So check that $('div.section:last').length > 0) Karl Rudd On Wed, Feb 25, 2009 at 1:40 PM, Rick Faircloth wrote: > (‘div.section:last’) ??? > > > > I’m trying to use it in this code: > > > > $(document).ready(function() { > > > > $(‘#add-section’).livequery(‘click’, function() { > > $.scrollTo(‘div.section:last’, 1000); > > }); > > > > }); > > > > FF3 does nothing with it…IE7 scrolls close to the top > > of the page, rather than to towards the bottom > > where the ‘last div with class=section’ has been created. > > > > Ideas on how to make this work, anyone? > > > > Thanks, > > > > Rick
[jQuery] Re: Is this a valid selector?
Thanks for the reply, Karl. I ran this code: $(document).ready(function() { $(‘#add-section’).livequery(‘click’, function() { $.scrollTo(‘div.section:last’, 1000); if ( $('div.section:last').length > 0 ) { alert('yes'); } else { alert('no'); }; }); }); I get a 'yes' alert every time. Just can't figure out why this isn't working. There are no div's with the class of 'section' near the top of the page at all... Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Karl Rudd Sent: Tuesday, February 24, 2009 9:49 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Is this a valid selector? Apologies for the last post, I clicked send before I was ready. Check to see that the 'div.section:last' selector actually returns a valid jQuery object. (So check that $('div.section:last').length > 0) Karl Rudd On Wed, Feb 25, 2009 at 1:40 PM, Rick Faircloth wrote: > (‘div.section:last’) ??? > > > > I’m trying to use it in this code: > > > > $(document).ready(function() { > > > > $(‘#add-section’).livequery(‘click’, function() { > > $.scrollTo(‘div.section:last’, 1000); > > }); > > > > }); > > > > FF3 does nothing with it…IE7 scrolls close to the top > > of the page, rather than to towards the bottom > > where the ‘last div with class=section’ has been created. > > > > Ideas on how to make this work, anyone? > > > > Thanks, > > > > Rick
[jQuery] Re: File Input field Help
The click event is bubbling, try adding event.stopPropagation() On Feb 24, 1:07 pm, Chris wrote: > Hello so I am trying to create an image that once clicked will trigger > the file input field but I am getting an error Here is what I am > doing: > > # Set the image in the div > $("#form_container").css({"background-image": "url(input.png)", > "width": "126px", > "height": "150px", > 'cursor': 'pointer' > > }); > > # set the field input out of viewable site. > $('input[type=file]').css({'overflow':'none', > 'position': 'relative', > 'opacity': '0', > 'top':'-1000px', // place element of > the grid > '-moz-opacity': '0' > > }); > > # When the div container is clicked, trigger the default file input > field action. > $("#form_container").click(function() { > $("#id_content").trigger('click'); > > }); > > HTML: > > > > > Here is the error that I receive when clicking: > > Firebug's log limit has been reached. %S entries not shown. > Preferences > too much recursion > [Break on this error] (function(){var R=/((?:\((?:\([^()]+\)|[... > (J,typeof K==="string"?K:K+"px")}})})(); > jquery-12.min.js (line 19) > too much recursion > [Break on this error] var msg = "Error in hook: "+ exc +" fn=\n"+fn > +"\n stack=\n"; > > Any thoughts? > > Thanks!
[jQuery] type-ahead/autocomplete plugin for textareas
Hello, I'm looking for a plugin that will autocomplete text in a textarea. Rather than a drop down menu I'd like to have the autocompleted text appear hilighted inside the textarea. Can anyone point me to a plugin that does something along these lines? -Matt
[jQuery] Re: Inserting text in IE8
On Feb 25, 6:20 am, robing wrote: > My problem isn't strictly jquery but more javaScript. > In IE6, 7 i can insert text on a range using pasteHTML(). > > in IE8 i can only pasteHTML() when text is selected and not when just > the cursor is placed. > > see here for very simple example. > > http://robing.xtools.co.nz/demo_cms/test_editor/ > > any idea's why? RTFM: "pasteHTML Method "Remarks "This method fails only when used inappropriately to paste HTML into a TEXTAREA element in Microsoft Internet Explorer 5 and later. ... "This feature might not be available on non-Microsoft Win32 platforms. ... "Standards Information "There is no public standard that applies to this method." http://msdn.microsoft.com/en-us/library/ms536656(VS.85).aspx > -- Rob
[jQuery] Re: Is this a valid selector?
Apologies for the last post, I clicked send before I was ready. Check to see that the 'div.section:last' selector actually returns a valid jQuery object. (So check that $('div.section:last').length > 0) Karl Rudd On Wed, Feb 25, 2009 at 1:40 PM, Rick Faircloth wrote: > (‘div.section:last’) ??? > > > > I’m trying to use it in this code: > > > > $(document).ready(function() { > > > > $(‘#add-section’).livequery(‘click’, function() { > > $.scrollTo(‘div.section:last’, 1000); > > }); > > > > }); > > > > FF3 does nothing with it…IE7 scrolls close to the top > > of the page, rather than to towards the bottom > > where the ‘last div with class=section’ has been created. > > > > Ideas on how to make this work, anyone? > > > > Thanks, > > > > Rick
[jQuery] Re: JQuery Events
Try putting the bulk of your code in a separate function: $(function() { // do check on document ready myFunction(); // make click work $('#Professor').click(myFunction); }); function myFunction() { if ( $('#Professor').get(0).checked ) { $('#ProfessorField').show(); $('#SubscriptionsField').show(); } else { $('#ProfessorField').hide(); $('#SubscriptionsField').hide(); } } On Feb 24, 3:53 pm, shapper wrote: > Hello, > > I have the following: > > $('#Professor').click(function(){ > if ( this.checked ) { > $('#ProfessorField').show(); > $('#SubscriptionsField').show(); > } else { > $('#ProfessorField').hide(); > $('#SubscriptionsField').hide(); > } > }) > > Basically on a form I am hiding/showing a few fieldsets when a > checkbox is selected or unselected. > > However, when I submit the form and there are errors, the page is > displayed again with the error messages. > > The problem is that the fields get visible independently of the > checkbox Professor value. > I don't know why ... So I added the following: > > $('#Professor').load(function(){ > if ( this.checked ) { > $('#ProfessorField').show(); > $('#SubscriptionsField').show(); > } else { > $('#ProfessorField').hide(); > $('#SubscriptionsField').hide(); > } > }) > > Still does not work ... any idea why? > > And since the code is the same can't I join the two events? > > Thanks, > Miguel
[jQuery] Re: Is this a valid selector?
The scrollTo function takes On Wed, Feb 25, 2009 at 1:40 PM, Rick Faircloth wrote: > (‘div.section:last’) ??? > > > > I’m trying to use it in this code: > > > > $(document).ready(function() { > > > > $(‘#add-section’).livequery(‘click’, function() { > > $.scrollTo(‘div.section:last’, 1000); > > }); > > > > }); > > > > FF3 does nothing with it…IE7 scrolls close to the top > > of the page, rather than to towards the bottom > > where the ‘last div with class=section’ has been created. > > > > Ideas on how to make this work, anyone? > > > > Thanks, > > > > Rick
[jQuery] Is this a valid selector?
('div.section:last') ??? I'm trying to use it in this code: $(document).ready(function() { $('#add-section').livequery('click', function() { $.scrollTo('div.section:last', 1000); }); }); FF3 does nothing with it.IE7 scrolls close to the top of the page, rather than to towards the bottom where the 'last div with class=section' has been created. Ideas on how to make this work, anyone? Thanks, Rick
[jQuery] Re: CheckBox - Select and Deselect
On Feb 24, 7:18 am, shapper wrote: > Hello, > > I have 8 inputs of type checkbox. > > On 4 of them (A, B, C and D) I want to deselect the other three when > one is selected. > > For example, if I select A I want B, C and D to be deselected. > If I select C I want A, B and D to be deselected. > > Is it possible to create this functionality? Use a set of radio buttons. -- Rob
[jQuery] Re: JQuery size: 19 KB ? 55 KB?
On Tue, Feb 24, 2009 at 4:16 PM, rasit wrote: > > Hi, all! > Homepage of JQuery says that JQuery is 19 KB (minified) Actually if you look closely it says Minified and Gzipped. The minified part takes it from 120KB to 55KB. The gzipping part takes it from 55KB to 19KB, but is undone by your web browser automatically by the time you save the file. > , but download > link goes to a file which is 55 KB. Does it need to be compressed? If > yes, how can I compress it? Minified, it's ready to be gzipped by a webserver. As far as how to have your server do that, that depends on what web server you're using, but most have some option to enable gzipping based on mime-type (ex. http://www.google.com/search?q=gzip+javascript+apache ). This typically happens on-the-fly, meaning you place the 55KB (minified but uncompressed) version on the server and it delivers the 19KB version to the browser. Such a configured server will also handle the negotiating with the client to make sure it can accept the gzipped version before sending it, falling back to uncompressed if not (though there is quite good support for gzipping in web browsers, even much older versions). - Richard
[jQuery] Ajax post in firefox doesn't work
Hello everyone, Recently I have just created a site using CodeIgniter with JQuery. And in the past, it worked just fine. But recently I don't know why I got error message in FireFox(3.0.6) through firebug and there is no result displayed in my site. However, it works just fine in IE. Are there any suggestions or solutions? The site is http://guessword.dictionary2gether.com/ Thanks, Makara Kao
[jQuery] Re: Horizontal animation works on F.F. IE7. Fails on IE6
I checked and did not find prob with z-index. So the A.P. was not covering the div containing the form buttons. (.panelpod). It was to do with an alpha image loader nonsense that was interfering with .panelpod containing buttons. /*--- alpha image loader nonsense causing the probs. ---*/ * html .panelmid {height: 1%; background:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/ panel-mid.png',sizingMethod='scale');} Thankyou for input. On Feb 23, 9:39 pm, Alexandre Plennevaux wrote: > in fact, i just tested it on IE6, and i can't even click on the form > inputs, so i 'd assume either you disabled them, or there is a > transparent div with a higher z-index that prevents from clicking it. > > On Mon, Feb 23, 2009 at 10:36 PM, Alexandre Plennevaux > > wrote: > > can you check taht for IE6, the element is not ALREADY at position > > left=0 ? hence no animation? > > > On Mon, Feb 23, 2009 at 6:22 PM, ab2qik wrote: > > >> Hi, > > >> Horizontal animation of an element works on F.F. IE7. It fails to work > >> on IE6? > > >> Example: > >> From:http://codesolv.net/se-update/library-slide.html > > >> Click on any radio button under Form factors heading. An element > >> slides open. > >> This can be closed by the top right close button. > > >> Works on F.F./IE7. > > >> Any suggegstions for a fix for IE6? > > >> Thankyou, > >> ab2qik
[jQuery] File Input field Help
Hello so I am trying to create an image that once clicked will trigger the file input field but I am getting an error Here is what I am doing: # Set the image in the div $("#form_container").css({"background-image": "url(input.png)", "width": "126px", "height": "150px", 'cursor': 'pointer' }); # set the field input out of viewable site. $('input[type=file]').css({'overflow':'none', 'position': 'relative', 'opacity': '0', 'top':'-1000px', // place element of the grid '-moz-opacity': '0' }); # When the div container is clicked, trigger the default file input field action. $("#form_container").click(function() { $("#id_content").trigger('click'); }); HTML: Here is the error that I receive when clicking: Firebug's log limit has been reached. %S entries not shown. Preferences too much recursion [Break on this error] (function(){var R=/((?:\((?:\([^()]+\)|[... (J,typeof K==="string"?K:K+"px")}})})(); jquery-12.min.js (line 19) too much recursion [Break on this error] var msg = "Error in hook: "+ exc +" fn=\n"+fn +"\n stack=\n"; Any thoughts? Thanks!
[jQuery] jQuery AJAX File Upload
I know, not possible to do without hidden iframe hacks and such and there already exists a couple of extensions which add this functionality by abstracting these hacks out of our sight... however, I ran across this article here: http://igstan.blogspot.com/2009/01/pure-javascript-file-upload.html Which talks about doing it in pure AJAX only in FF3, he gives source code to do this, however I was wondering if this sort of functionality was already possible or could be mimicked using the jQuery.ajax object. The reason I ask is because I'm interested in developing a Ubiquity (http://labs.mozilla.com/2008/08/introducing-ubiquity/) command which would upload a local file to a web service... and Ubiquity is only for FF and includes the jQuery library in their namespace. If this isn't currently possible, is anyone interested in helping me to extend jQuery with this functionality and submit for inclusion in a future version? I'm pretty new to the contributing to open source community and don't know the best practices for getting and submitting new source code to an open project. Thanks a lot. - Gooseus
[jQuery] JQuery size: 19 KB ? 55 KB?
Hi, all! Homepage of JQuery says that JQuery is 19 KB (minified), but download link goes to a file which is 55 KB. Does it need to be compressed? If yes, how can I compress it? Thanks, Rasit
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
Liam, $() can take one or two arguments. The first argument is what your searching for. The second argument is the context in which you are searching. If you only use one argument, the second defaults to the whole dom. $("#foo p") searches for all p in #foo. It does this by getting every p element in the document and then selecting the ones inside #foo. The other option uses a second argument to limit the scope. $("#foo") returns #foo. $("p", $("#foo")) uses #foo as its context instead of the whole dom. Just to clarify, $("p", "#foo") would be meaningless, because #foo isn't its own context. It needs to be an object returned by jquery. $ ("p, #foo") would give you both all p's and all #foo's, which is not what you want in this circumstance. On Feb 24, 8:49 am, Liam Potter wrote: > ok, but what in jquery knows that $("p", $("#foo")) should look for the > p tags inside of #foo, why does it treat it like $("#foo p")? > > > > jQuery Lover wrote: > > Liam, you can use $("p", "#foo"). The second parameter must be a > > jQuery object or dom element... > > > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > On Tue, Feb 24, 2009 at 6:44 PM, Liam Potter > > wrote: > > >> Hi Stehpan :p > > >> I understand that, I'm just not sure why $("p", $("#foo")) is not the same > >> as $("p", "#foo") > > >> - Liam > > >> Stephan Veigl wrote: > > >>> Hi Lima, > > >>> 1) #foo is an ID and since IDs should be unique there has to bee only > >>> one #foo element > > >>> 2) $("p", $("#foo")) selects all elements in the scope of the #foo > >>> element. > >>> In other words, it selects every element under #foo in the DOM tree. > > >>> by(e) > >>> Stephan > > >>> 2009/2/24 Liam Potter : > > I've been following this discussion, but I need explaining why $("p", > $("#foo")) doesn't select all p tags and all #foo id's ? > > Stephan Veigl wrote: > > > Hi, > > > I've done some profiling on this, and $("p", $("#foo")) is faster than > > $("#foo p") in both jQuery 1.2.6 and 1.3.2. > > > the test HTML consists of 100 s in a "foo" and 900 s in a > > "bar" . > > > However the factor differs dramatically: > > In 1.2.6 the speedup from $("p", $("#foo")) to $("#foo p") was between > > 1.5x (FF) and 2x (IE), > > while for 1.3.2 the speedup is 20x (FF) and 15x (IE). > > > $("p", $("#foo")) is faster in 1.3.2, by a factor of 1.5 (both FF and > > IE), > > while $("#foo p") is _slower_ in 1.3.2 by 8.5x (FF) and 4.6x (IE). > > > Even with an empty "bar" div $("p", $("#foo")) is faster by a factor up > > to > > 3x. > > > Conclusion: > > If you have an ID selector, first get the element by it's ID and use > > it as scope for further selects. > > > by(e) > > Stephan > > 2009/2/23 ricardobeat : > > >> up to jQuery 1.2.6 that's how the selector engine worked (from the top > >> down/left to right). The approach used in Sizzle (bottom up/right to > >> left) has both benefits and downsides - it can be much faster on large > >> DOMs and some situations, but slower on short queries. I'm sure > >> someone can explain that in better detail. > > >> Anyway, in modern browsers most of the work is being delegated to the > >> native querySelectorAll function, as so selector performance will > >> become more of a browser makers' concern. > > >> - ricardo > > >> On Feb 23, 1:08 pm, Peter Bengtsson wrote: > > >>> I watched the John Resig presentation too and learned that CSS > >>> selectors always work from right to left. > >>> That would mean that doing this:: > > >>> $('#foo p') > > >>> Would extract all tags and from that list subselect those who > >>> belong to #foo. Suppose you have 1000 tags of them only 100 are > >>> inside #foo you'll have wasted 900 loops. > > >>> Surely $('#foo') is the fastest lookup possible. Doing it this way > >>> will effectively limit the scope of the $('p') search and you will > >>> never be bothered about any tags outside #foo. > > >>> Or am I talking rubbish?
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
I want to point out a couple things: 1) You should always use $("#foo").find("p") in favor of $("p", $ ("#foo")) - the second one ends up executing $(...) 3 times total - only to arrive at the same result as doing $("#foo").find("p"). 2) I generally dislike saying that there's one good way to do a selector (especially with one that has such bad syntax, as above) - especially since it may not always be that way. In fact, I've already filed a bug and I'll be looking in to this issue, possibly resolving it tonight or tomorrow - at which point the advice will be false again. http://dev.jquery.com/ticket/4236 My recommendation is to always write the simplest, easiest to understand, expression: jQuery will try to do the rest to optimize it. --John On Feb 24, 10:23 am, Stephan Veigl wrote: > Hi Karl, > > $('#foo').find('p') and $('p', $('#foo')) are approximately of the same speed. > > I've put the test code on JSBin, so everybody can play around with it > and try other combinations :-)http://jsbin.com/ifemo > > by(e) > Stephan > > 2009/2/24 Karl Swedberg : > > > Hi Stephan, > > Thanks for doing this testing! Would you mind profiling $('#foo').find('p') > > as well? I suspect it will be roughly equivalent to $('p', $('#foo')) > > Cheers, > > > --Karl > > > > Karl Swedberg > >www.englishrules.com > >www.learningjquery.com > > > On Feb 24, 2009, at 8:28 AM, Stephan Veigl wrote: > > > Hi, > > > I've done some profiling on this, and $("p", $("#foo")) is faster than > > $("#foo p") in both jQuery 1.2.6 and 1.3.2. > > > the test HTML consists of 100 s in a "foo" and 900 s in a > > "bar" . > > > However the factor differs dramatically: > > In 1.2.6 the speedup from $("p", $("#foo")) to $("#foo p") was between > > 1.5x (FF) and 2x (IE), > > while for 1.3.2 the speedup is 20x (FF) and 15x (IE). > > > $("p", $("#foo")) is faster in 1.3.2, by a factor of 1.5 (both FF and IE), > > while $("#foo p") is _slower_ in 1.3.2 by 8.5x (FF) and 4.6x (IE). > > > Even with an empty "bar" div $("p", $("#foo")) is faster by a factor up to > > 3x. > > > Conclusion: > > If you have an ID selector, first get the element by it's ID and use > > it as scope for further selects. > > > by(e) > > Stephan > > 2009/2/23 ricardobeat : > > > up to jQuery 1.2.6 that's how the selector engine worked (from the top > > > down/left to right). The approach used in Sizzle (bottom up/right to > > > left) has both benefits and downsides - it can be much faster on large > > > DOMs and some situations, but slower on short queries. I'm sure > > > someone can explain that in better detail. > > > Anyway, in modern browsers most of the work is being delegated to the > > > native querySelectorAll function, as so selector performance will > > > become more of a browser makers' concern. > > > - ricardo > > > On Feb 23, 1:08 pm, Peter Bengtsson wrote: > > > I watched the John Resig presentation too and learned that CSS > > > selectors always work from right to left. > > > That would mean that doing this:: > > > $('#foo p') > > > Would extract all tags and from that list subselect those who > > > belong to #foo. Suppose you have 1000 tags of them only 100 are > > > inside #foo you'll have wasted 900 loops. > > > Surely $('#foo') is the fastest lookup possible. Doing it this way > > > will effectively limit the scope of the $('p') search and you will > > > never be bothered about any tags outside #foo. > > > Or am I talking rubbish?
[jQuery] JQuery Events
Hello, I have the following: $('#Professor').click(function(){ if ( this.checked ) { $('#ProfessorField').show(); $('#SubscriptionsField').show(); } else { $('#ProfessorField').hide(); $('#SubscriptionsField').hide(); } }) Basically on a form I am hiding/showing a few fieldsets when a checkbox is selected or unselected. However, when I submit the form and there are errors, the page is displayed again with the error messages. The problem is that the fields get visible independently of the checkbox Professor value. I don't know why ... So I added the following: $('#Professor').load(function(){ if ( this.checked ) { $('#ProfessorField').show(); $('#SubscriptionsField').show(); } else { $('#ProfessorField').hide(); $('#SubscriptionsField').hide(); } }) Still does not work ... any idea why? And since the code is the same can't I join the two events? Thanks, Miguel
[jQuery] Re: listnav related - DL
I started working on a version that will work on any child elements. For example: A item B item Some stuff under the B item C item That would result in nav items for A, B and C, but would not handle a case, because is not nested inside of (ie: the 's are also child elements of the main div). I'm not sure if the "any tag" change will make it into this rev, still haven't decided, but I'll keep thinking about a handler for 's. I can appreciate the need for it. Thanks, Jack MauiMan2 wrote: Yes, you've got the right idea. I have the very rudimentary beginnings of my glossary here: http://www.usmexfood.com/ And the code for it so far: Glossary Burrito A flour tortilla stuffed with beans, meat, cheese and other fillings and folded and wrapped compactly Habañero A particularly spicy chili pepper
[jQuery] Re: jquery.listnav
Hi Sam, Sorry about taking a while to get back to you about this: for some reason this message didn't show up in my inbox til today. Very strange (this one and another one). I have a new rev of listnav almost ready and am expecting to release it this week. Would you like to try the beta version and see if the performance has changed? I didn't specifically change anything in that area, but my tests so far are looking pretty good for larger lists (I'm also testing using jquery 1.3.2, which might be part of it). Thanks, Jack Sam wrote: Thanks for the quick response. It does seem to be okay in IE7, but slow in FF3.1 and Chrome. I also added the timeout as you indicated, but that did not seem to have an effect. My research showed it was in the last phase of the init process, where it decides whether to show all or click on a letter. If I set the options to includeAll, but don't specify a letter, FF loads faster initially, but the first letter click shows the delay. - Sam
[jQuery] Changing Background Image on A tag when clicked not working
Basically all I am doing is on click I am changing the class of the a tag to have a different background image then the class that is applied on load. I remove the initial class and replace it with the new one. Both have different background images but for some it isn't working. The class changes and everything in firebug shows the correct class and background image but the image is still the old one. But for some reason if I double click the a tag it works. Here is the code, there is a bit more going on but I think you can see what I am trying to do with the click. On page load I put the class of open on all the links that also have the view. I originally had it just for the view class but thought that might be my issue. when you click the link i toggle another div. If that div is visible remove the class open that has one background image and add the class close that has the other. Everything works perfectly but the background image appearing. $(".view",".prodcollection-desc li").click(function (){ categoryPage.showHideSubCat(this); return false; }); showHideSubCat: function(link){ $(".quick-view", $(link).parent("li")).toggle(); if ($(".quick-view", $(link).parent("li").is(":visible"))){ $(link).removeClass("open"); $(link).addClass("close"); setTimeout( function() { $(".quick-view", $(link).parent("li")).hide(); $(link).addClass("open"); $(link).removeClass("close"); }, 7000 ); } },
[jQuery] Re: CheckBox - Select and Deselect
Basically I have 8 roles. I need to be able to select one or many. However in 4 of them one can only be selected. I could separate it but since it's all for the same thing ... ... this is why I am not using radio .. I need to be able to select more than one. It is working Thank You, Miguel On Feb 23, 9:38 pm, MorningZ wrote: > Easier/makes-more-sense: > - Why not use a radio box group then? > > Otherwise: > - Using jQuery to mimic functionality w/ CheckBox > > > > > > > $(document).ready(function() { > $("#A, #B, #C, #D").change(function() { > var ThisID = this.id; > $("#A, #B, #C, #D").each(function() { > if (this.id != ThisID) { this.checked = false; } > }) > }); > > }) > > On Feb 23, 4:18 pm, shapper wrote: > > > Hello, > > > I have 8 inputs of type checkbox. > > > On 4 of them (A, B, C and D) I want to deselect the other three when > > one is selected. > > > For example, if I select A I want B, C and D to be deselected. > > If I select C I want A, B and D to be deselected. > > > Is it possible to create this functionality? > > > Thanks, > > Miguel
[jQuery] Re: failing miserably in IE
Thanks MorningZ, strange that that is not the error I'm getting at all. My errors have pointed a break in the jquery.1.3.1.min.js (which seemed odd). I completely removed the references to dynacloud, but still get the jquery and google maps errors. I've got the debugging on in IE, that's how i'm seeing the errors. I actually tried to fix the plugin to work with noconflict, (before you saw it), but even with the link you sent, i am somewhat lost on how to do that. I'll load up another version later today, but I'm finding this very puzzling (and i actually had the problem before noconclict was turned on. On Feb 24, 2:29 pm, MorningZ wrote: > In times like this, turning on Script Debugging in IE is very helpful > (tools/options/advanced/uncheck-"disable script debugging") > > pulling up the link above with debugging on pointed out the problem > right away: > > "Error: '$' is null or not an object" > for the line > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > looking at the code in "dynaCloud.js" > > -- > jQuery.fn.dynaCloud = function() { > return this.each(function() { > //var now = new Date().getTime(); > > var cl = []; > var max = 2000; > var min = 10 > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > var count = $.dynaCloud.max == -1 ? 50 : $.dynaCloud.max; > -- > > he didn't follow this convention > > http://www.learningjquery.com/2007/10/a-plugin-development-pattern > (scroll down to 'Keep private functions private', which makes sure > that the code can use "$" even if "noConflict" is specified) > > fix up that plugin script and you should be all good > > On Feb 24, 4:56 pm, pedalpete wrote: > > > So I got a version up and running, obviously you'll see by looking > > this that it isn't a complete work, but if fails completely in IE, but > > works in FF & Chrome. > > >http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ > > > I've picked it apart and put it back together, and it seems I just > > keep ending up with different errors as I get deeper and deeper into > > it, and the errors that are getting reported are with google maps, or > > the the datePicker, or genre cloud. any ajax requests, etc. > > Really any non-core (with the exception of ajax) function just doesn't > > work. > > > Any ideas on how to track this down would be greatly appreciated.
[jQuery] Re: IE6 - what's the absolute fastest way to append DOM nodes?
Here's a thread that will help you out: http://groups.google.com/group/jquery-en/browse_thread/thread/9889ebd5e10c9122 Create the table with any content, but leave out the Then use the looping method with the arrays. At the beginning and the end of the array before and after your loop, include the and tags, respectively. Then join() them and append it as one whole chuck into your DOM. On Feb 24, 2:16 pm, Dave Methvin wrote: > > Is there any way to do this faster? > > Create the full table in a string, including the tags, and > insert it into the document at one time. Each time you insert an > element into the document, the browser does some calculations and > checks. By doing it in one insert you save it work. > > Whenever you're dealing with HTML in strings, be careful about > escaping characters like > that may be in the actual content and need > to be rendered literally. At minimum you'll want to convert < to < > and > to > for safety.
[jQuery] Re: IE6 - what's the absolute fastest way to append DOM nodes?
On Feb 25, 8:24 am, morgancodes wrote: > Hello, > I'm trying to squeeze out every last bit of performance I can from > IE6, and want to make sure there isn't a faster way than what I'm > doing. > > I'm doing about 180 iterations of somethig like the following > > parentElem = $("parentTable"); > for(var i = 0; i<400; i++){ > $(tableRowHTML[i]).appendTo(parentElem) > > } If speed really matters, forget jQuery methods. Presumably 'parentTable' is a reference to the table and tableRowHTML is an array of HTML for the new table rows. You can get a bit of a boost (20 to 30%) by not iterating and just doing: $(tableRowHTML.join('')).appendTo(parentElem); However, that is still a sluggard, *the* fastest method (as in 100 times faster than either of the above in IE 6) is to use innerHTML like: var div = document.createElement('div'); div.innerHTML = '' + sA.join('') + ''; parentTable.appendChild(div.firstChild.tBodies[0]); You can also just replace the current tbody with the new one if that is required: parentElem.replaceChild(div.firstChild.tBodies[0], parentElem.tBodies [0]); It will add 2,000 rows in less than 100ms (using pretty trivial 1 cell row with a bit of text). -- Rob
[jQuery] Re: IE6 - what's the absolute fastest way to append DOM nodes?
> Is there any way to do this faster? Create the full table in a string, including the tags, and insert it into the document at one time. Each time you insert an element into the document, the browser does some calculations and checks. By doing it in one insert you save it work. Whenever you're dealing with HTML in strings, be careful about escaping characters like > that may be in the actual content and need to be rendered literally. At minimum you'll want to convert < to < and > to > for safety.
[jQuery] Re: improper function
Another thing I was wondering is there a way to slow down the speed of the carousel when the mouse hovers over it? There is such a small area where it actually moves at a reasonable speed, outside of that it moves extremely quickly and the 'speed' parameter seems to make no difference in it. Is there a way to nest the carousel in a table cell? It seems to ignore the layout and go on top of everything else. Is it possible to restrict the mouse hover area for the carousel? No matter where my mouse is on the screen it is manipulating the carousel speed. Hopefully there is solutions to each of these questions. I havnt found any parameters that control these elements. Thanks a lot On Feb 23, 3:54 pm, surreal5335 wrote: > thanks alot for the response, I figured out why I wasnt getting the > address right. > > This is the correct one: > > http://royalvillicus.com/photo_site/photo.html > > I was able to get the error to go away and the scroll to semi come up. > right now it is very far to the left and half way off screen. Another > problem I noticed is that horizontal control is over by the "enter > site" link and there doesnt seem to be any vertical hold, just seems > to stretch from the bottom of the screen to the top. > > One last thing any idea on how to make a vertical duplicate of this > scroll instead of the horizontal one I have now? > > Thank you very much for all your help > > On Feb 20, 7:11 pm, ricardobeat wrote: > > > Your function looks fine. The URL given does not exist. > > > jQuery(function($){ > > $("#carousel") > > .html( $("#holder_images").html() ) > > .carousel3d({ > > control: 'continuous', > > radiusY: 0, > > speed: 1, > > radiusX: 250, > > fadeEffect: 1, > > centerX: $('#carousel').offset().left + $ > > ('#carousel').width()/2 > > }); > > > }); > > > On Feb 20, 6:46 pm,surreal5335 wrote: > > > > I posted this earlier today, but couldnt find it when I chacked back > > > again, I guess it didnt go through all the way. > > > > I got this code that worked great by itself, but in my site it doesnt > > > work, says its an improper function. Does any one have any idea as to > > > how to solve this? > > > > jQuery(function($) { > > > $("#carousel").html( > > > $("#holder_images").html()).carousel3d({ control: 'continuous', > > > radiusY: 0, speed: 1, radiusX: 250, fadeEffect: 1, centerX: $ > > > ('#carousel').offset().left + $('#carousel').width()/2 }); > > > }); > > > > Here is the link to the page that contains this code: > > > >http://royalvillicus.com/photosite/photo.html > > > > Thanks a lot for all you help
[jQuery] Re: adding html to tab labels
solved... wasn't liking my floating divs... On Feb 25, 9:48 am, Paul Georges wrote: > i'm trying to add some html to the label area of tabs in order to add > an icon and also some divs that i can access at later times to modify > easily. > > any suggestions on how to do this? > > at the moment i'm doing something like this > > $("#tabs").tabs('add' , '#' + tag, ' style="float: left;"> height="16" border="0" /> style="float: right;">' + nick + ''); > > it does what i want it to... but it comes out quite weird. green > lines, offsets, all kinds of gross stuff. > > thanks heaps
[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)
bump - if someone can easily clarify I'd love a response On Feb 24, 8:47 am, greghauptmann wrote: > still getting a bit confused with options here, can I ask: > > • re "iecanvas.js" - is there a way to effectively include this in > one's project then only write one (1) set of code (javascript, or > jquery or whatever) such that it will work both on (a) IE and (b) > firefox? > > • if no, then perhaps at this stage the most solid approach for a > browser based view of my topology tree would be to use a Java applet. > comments? > > thanks
[jQuery] basic news ticker
Hi there, I'm trying to write a news ticker script that horizontally slides 1 item from right to left in a box. Most news ticker scripts use multiple items for this, but my needs are somewhat different. Well I've kinda got it working, except for when I hover over it. Then when the cursor goes away, the speed's been affected as well as the item stops ticking by. Here is my code: $(document).ready(function() { function scroller() { $('#newsticker ul li').animate( {left: "-200px"}, 2000, "linear", function(){ $(this).css("left", "200px"); scroller(); } ) .hover( function(){ jQuery(this).stop() }, function(){ $(this).css("left", 200 - $(this).position().left); scroller(); }); }; scroller(); });
[jQuery] basic news ticker
Hi there, I'm trying to write a news ticker script that horizontally slides 1 item from right to left in a box. Most news ticker scripts use multiple items for this, but my needs are somewhat different. Well I've kinda got it working, except for when I hover over it. Then when the cursor goes away, the speed's been affected as well as the item stops ticking by. Here is my code: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> jQuery news ticker test #newsticker { width: 198px; border: 1px solid #999; overflow: hidden; height: 20px; padding: 2px; font: 12px Arial #000; } #newsticker ul { list-style: none; margin: 0px; padding: 0px; width: 600px; position: relative; } #newsticker ul li { display: inline-block; margin: 0px 5px; position: absolute; left: 200px; } $(document).ready(function() { function scroller() { $('#newsticker ul li').animate( {left: "-200px"}, 2000, "linear", function(){ $(this).css("left", "200px"); scroller(); } ) .hover( function(){ jQuery(this).stop() }, function(){ $(this).css("left", 200 - $(this).position().left); scroller(); }); }; scroller(); }); testing 1 - test
[jQuery] adding html to tab labels
i'm trying to add some html to the label area of tabs in order to add an icon and also some divs that i can access at later times to modify easily. any suggestions on how to do this? at the moment i'm doing something like this $("#tabs").tabs('add' , '#' + tag, '' + nick + ''); it does what i want it to... but it comes out quite weird. green lines, offsets, all kinds of gross stuff. thanks heaps
[jQuery] jQuery Cycle, multi-effects
Hi Mike, Loving the multi-effect. Would it be possible to use them in this way...? In the same slideshow: left/right arrows make the slides slide left/right up/down arrows make the slide slide up/down Thanks Andrej
[jQuery] Re: failing miserably in IE
In times like this, turning on Script Debugging in IE is very helpful (tools/options/advanced/uncheck-"disable script debugging") pulling up the link above with debugging on pointed out the problem right away: "Error: '$' is null or not an object" for the line if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { looking at the code in "dynaCloud.js" -- jQuery.fn.dynaCloud = function() { return this.each(function() { //var now = new Date().getTime(); var cl = []; var max = 2000; var min = 10 if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { var count = $.dynaCloud.max == -1 ? 50 : $.dynaCloud.max; -- he didn't follow this convention http://www.learningjquery.com/2007/10/a-plugin-development-pattern (scroll down to 'Keep private functions private', which makes sure that the code can use "$" even if "noConflict" is specified) fix up that plugin script and you should be all good On Feb 24, 4:56 pm, pedalpete wrote: > So I got a version up and running, obviously you'll see by looking > this that it isn't a complete work, but if fails completely in IE, but > works in FF & Chrome. > > http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ > > I've picked it apart and put it back together, and it seems I just > keep ending up with different errors as I get deeper and deeper into > it, and the errors that are getting reported are with google maps, or > the the datePicker, or genre cloud. any ajax requests, etc. > Really any non-core (with the exception of ajax) function just doesn't > work. > > Any ideas on how to track this down would be greatly appreciated.
[jQuery] IE6 - what's the absolute fastest way to append DOM nodes?
Hello, I'm trying to squeeze out every last bit of performance I can from IE6, and want to make sure there isn't a faster way than what I'm doing. I'm doing about 180 iterations of somethig like the following parentElem = $("parentTable"); for(var i = 0; i<400; i++){ $(tableRowHTML[i]).appendTo(parentElem) } There's an acceptable delay in FF and IE7 (no more than one second), but up to 3.5 seconds in IE. Is there any way to do this faster? thanks, -Morgan
[jQuery] Re: adding tabs dynamically
yup figured it out, thanks guys finally i don't change the template... i do something like this. // add a tab with the the nick specified $("#tabs").tabs('add' , '#' + tag, '' + nick + ''); // correct the holding div $("#" + tag).attr("style", "width: 95%; height: 80%;"); // add the content $("#" + tag).html(''); // select the added tab $("#tabs").tabs('select' , tag); On Feb 23, 7:49 pm, Klaus Hartl wrote: > You could add that to the template. Or use the add callback to > populate the tab: > > $('#whatever').tabs({ > add: function(event, ui) { > $(ui.panel).html( ... ) > .find('input'); // do something with these inputs > } > > }); > > It seems you have to use the add callback anyway to get to these > inputs. If you use the template you only wouldn't need the html() > call. > > --Klaus > > On 23 Feb., 02:29, Paul Georges wrote: > > > awesome, thanks. can't believe i missed that one. > > > and as for the content of the tab? if i wanted a tab to always have > > two textboxes, should i modify the template? and then who would i > > access these two input boxes dynamically? > > > thanks heaps > > > paul > > > On Feb 21, 12:41 am, Klaus Hartl wrote: > > > > Why don't you put the desired label in the first place? > > > > $('#tabs').tabs('add', '#new', 'Label'); > > > > Other than that you could utilize the add callback: > > > > $('#tabs').tabs({ > > > add: function(event, ui) { > > > // add additional html to the tab > > > $('span', ui.tab).html(...); > > > } > > > > }); > > > > Or you can change the tabTemplate option and add that html there... > > > > --Klaus > > > > On 20 Feb., 06:01, Paul Georges wrote: > > > > > hey guys and gals, > > > > >http://docs.jquery.com/UI/Tabs > > > > > followed the above docs but couldn't quite add tabs correctly yet. i > > > > can add a tab, yes, but then i can't change it's label or innerHTML. > > > > how can i do this? > > > > > cheers! > > > > > Paul!
[jQuery] Event Problem
Dear folk , I have a Link and it makes ajax call , so the problem is ,whenever somebody clicks tons of time inn the Link it crashes and the AJax it will not work , so I solved this Problem with using of the Boolean variable and make it True and then the event is trigered cahnge it to false so it makes it work , but I was wondering if I can Prevent it with the JQuery event Object . this is the Sample var status=ture; $("a").click(function(){ status=false; $.ajax({ .. .. success: function(){ status=true; } }); I'm sick and tired of doing this . I want to git rid of these Statuses }); Thanks Pedram
[jQuery] Re: invalid array length wit jquery.extend
Cool. Thanks for the ticket. On Feb 23, 7:03 pm, Dave Methvin wrote: > If the object has a length property, it is assumed to be Array-like. > There are several Objects that have Array-like behavior, like jQuery > objects, DOM NodeList objects, and Function.arguments. > > In this case, you've specified a deep copy so when $.extend sees the > nested object in prop it thinks the object is Array-like. > > I've opened a ticket on this because it may need to be revisited: > > http://dev.jquery.com/ticket/4227
[jQuery] Re: jQuery and IE
Some my exp! Aslo, take a notice that Something lieks this: messages: { name: { required: "You must provide a Campaign Name.", minlength: "Your Campaign name must be at least 3 characterss long." }, startDate: { required: "You must provide a start date." }, endDate: { required: "You must provide an end date." }*, //LAST COMMA* } Will work fine in FF, but won't in IE because of last comma! I have ever encounter this issues! Hope it will help you little! 2009/2/24 Bob O > > Thank you..i just figured that out..Appreciate all those that > commented.. > > Thanks > > On Feb 24, 2:29 pm, James wrote: > > Sorry I missed a comma after startDate and before endDate: > > > > messages: { > >name: { > > required: "You must provide a Campaign Name.", > > minlength: "Your Campaign name must be at least 3 > > characterss long." > >}, > >startDate: { > > required: "You must provide a start date." > >}, > >endDate: { > > required: "You must provide an end date." > >} > > > > } > > > > On Feb 24, 11:28 am, James wrote: > > > > > messages: { > > >name: { > > > required: "You must provide a Campaign Name.", > > > minlength: "Your Campaign name must be at least 3 > > > characterss long." > > >}, > > >startDate: { > > > required: "You must provide a start date." > > >} > > >endDate: { > > > required: "You must provide an end date." > > >} > > > > > } > > > > > On Feb 24, 10:59 am, Bob O wrote: > > > > > > sorry..new to the group thing here as well... > > > > > > i have narrowed it down to this piece of code. > > > > > > when i remove it all js works as written.. > > > > > > $(document).ready(function() { > > > > $('#create_campaign_form').validate({ > > > > rules: { > > > >name: {required: true, minlength: 3}, > > > >startDate: {required: true, date: true}, > > > >endDate: {required: true, date: true} > > > >}, > > > > messages: { > > > >name: {required: "You must provide a Campaign Name.", > > > > minlength: "Your Campaign name must be at least 3 characterss > long."}, > > > >startDate: required: "You must provide a start date.", > > > >endDate: required: "You must provide an end date." > > > >} > > > > });}); > > > > > > this piece of validation code causes the js to stop and nothing on > the > > > > page works..But this code does work in the other browsers..ive been > > > > reading on the trailing comma, but im not seeing where that could be > > > > faulting.. > > > > > > On Feb 24, 12:35 pm, Bob O wrote: > > > > > > > So im stumped..I have my jquery file in the headers, and it works > in > > > > > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > > > > > IE..its there, its just broken. > > > > > > > i recently added the validation plugin? > > > > > > > could there be something im missing? >
[jQuery] Re: failing miserably in IE
So I got a version up and running, obviously you'll see by looking this that it isn't a complete work, but if fails completely in IE, but works in FF & Chrome. http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ I've picked it apart and put it back together, and it seems I just keep ending up with different errors as I get deeper and deeper into it, and the errors that are getting reported are with google maps, or the the datePicker, or genre cloud. any ajax requests, etc. Really any non-core (with the exception of ajax) function just doesn't work. Any ideas on how to track this down would be greatly appreciated.
[jQuery] Re: jQuery and IE
Thank you..i just figured that out..Appreciate all those that commented.. Thanks On Feb 24, 2:29 pm, James wrote: > Sorry I missed a comma after startDate and before endDate: > > messages: { > name: { > required: "You must provide a Campaign Name.", > minlength: "Your Campaign name must be at least 3 > characterss long." > }, > startDate: { > required: "You must provide a start date." > }, > endDate: { > required: "You must provide an end date." > } > > } > > On Feb 24, 11:28 am, James wrote: > > > messages: { > > name: { > > required: "You must provide a Campaign Name.", > > minlength: "Your Campaign name must be at least 3 > > characterss long." > > }, > > startDate: { > > required: "You must provide a start date." > > } > > endDate: { > > required: "You must provide an end date." > > } > > > } > > > On Feb 24, 10:59 am, Bob O wrote: > > > > sorry..new to the group thing here as well... > > > > i have narrowed it down to this piece of code. > > > > when i remove it all js works as written.. > > > > $(document).ready(function() { > > > $('#create_campaign_form').validate({ > > > rules: { > > > name: {required: true, minlength: 3}, > > > startDate: {required: true, date: true}, > > > endDate: {required: true, date: true} > > > }, > > > messages: { > > > name: {required: "You must provide a Campaign Name.", > > > minlength: "Your Campaign name must be at least 3 characterss long."}, > > > startDate: required: "You must provide a start date.", > > > endDate: required: "You must provide an end date." > > > } > > > });}); > > > > this piece of validation code causes the js to stop and nothing on the > > > page works..But this code does work in the other browsers..ive been > > > reading on the trailing comma, but im not seeing where that could be > > > faulting.. > > > > On Feb 24, 12:35 pm, Bob O wrote: > > > > > So im stumped..I have my jquery file in the headers, and it works in > > > > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > > > > IE..its there, its just broken. > > > > > i recently added the validation plugin? > > > > > could there be something im missing?
[jQuery] Re: Order Items. Please help me. Thank You.
The problem is t[1] is now an array of objects, so you have to access the text and value attributes of the objects by their array index. Here are the buildThemesList function and the friendlyLevels functions rewritten to account for that. function buildThemesList(){ ol.empty(); //more string concatenation than I like, but OK if you aren't building a huge list $.each(themes,function(i,t){ //this handles the li content var li = $('').addClass('Themes').html(t[0].text+'' +friendlyLevels(t[1])+'' +(t[2]==''?'':t[2]+'') +'Remove' ).appendTo(ol); //now the inputs, this could also be done in another loop with an array of names, if it gets longer; and the brackets in the name are still a bad idea $('').attr({'type':'hidden','name':'Themes['+i +'].Subject'}).val(t[0].value).appendTo(li); $('').attr({'type':'hidden','name':'Themes['+i +'].LevelCsv'}).val($.map(t[1],function(l,i){return l.value;}).join ()).appendTo(li); $('').attr({'type':'hidden','name':'Themes['+i +'].Note'}).val(t[2]).appendTo(li); }); //just to keep things exactly as the original example's UI $('#Index').val(themes.length); } function friendlyLevels(levels) { if (levels.length == 1){ return levels[0].text; } var friendly = ""; $.each(levels,function(i,l){ friendly += l.text + ((i==levels.length-2)?' e ': (i==levels.length-1)?'':', '); }); return friendly; } Couple of things to note: friendlyLevels now has {} enclosing the first if statement. You'll see lots of coders not do that, but it's really a good idea, and not just a style choice: javascript suffers from automatic semicolon insertion which although not a common problem to run into, could make things difficult to debug. Even though there are only three checkboxes, the each function with the ternary means you don't have to refactor if you decide to add more checkboxes. To get the values into the hidden input, $.map() is used. Check it out in the documentation. Hope this helps. On Feb 24, 11:20 am, shapper wrote: > @Michael, > > I just installed Firebug and I almost made this working. > The only problem I have is when I am adding the levels to the list as > html and as hidden input: > > +friendlyLevels(t[1].text.join(', '))+'' > > $('').attr({'type':'hidden','name':'Themes['+i > +'].LevelCsv'}).val(t[1].value.join()).appendTo(li); > > I get an error in Firebug: > t[1].text is undefined > [Break on this error] +friendlyLevels(t[1].text.join(', '))+'' > > But as far as I know to get the text and value I use .text and .value. > > My friendlyLevels function is > > function friendlyLevels(levels) { > if (levels.length < 2) return levels.join(''); > var first = levels.slice(0, -1), last = levels.slice(-1); > var friendly = first.join(', '); > if (last) { friendly += ' e ' + last; } > return friendly; > } > > I am trying to display a join of the values in the hidden input and a > join of the texts in the html but using friendlyLevels or anything > similar to add the "e" at the end. > I removed your code just because it was adding the "e" only for 3 > items and using a function makes the code less confusing. > > I updated my code in:http://www.27lamps.com/Beta/List/List5.html > > I plan to optimize my code but first I would like to make it work so I > can optimize it step by step. > > @seasoup > > I didn't forgot the problems you mentioned about using [] ... But what > would you suggest to replace []? > > I can post the suggestion on ASP.NET MVC forums where I participate on > a daily basis. > > I am using Microsoft ASP.NET MVC which gives me complete control of > the HTML but still allows me to use C# and SQL. > > Microsoft ASP.NET MVC ships now with JQuery since there was a > partnership created between JQuery creators and Microsoft. > > This is the reason why I am starting with JQuery but I am still > learning ... but until now it seams great. > > Thanks, > Miguel > > http://www.27lamps.com/Beta/List/List5.html > > On Feb 24, 4:57 pm, mkmanning wrote: > > > Creating a complete html string won't solve the current problem; it is > > faster, and usually the way I prefer doing it also (see my note > > further below though), but as I indicated in a code comment, since > > this appears to be based on user input, the list (hopeful
[jQuery] Re: jQuery and IE
Sorry I missed a comma after startDate and before endDate: messages: { name: { required: "You must provide a Campaign Name.", minlength: "Your Campaign name must be at least 3 characterss long." }, startDate: { required: "You must provide a start date." }, endDate: { required: "You must provide an end date." } } On Feb 24, 11:28 am, James wrote: > messages: { > name: { > required: "You must provide a Campaign Name.", > minlength: "Your Campaign name must be at least 3 > characterss long." > }, > startDate: { > required: "You must provide a start date." > } > endDate: { > required: "You must provide an end date." > } > > } > > On Feb 24, 10:59 am, Bob O wrote: > > > sorry..new to the group thing here as well... > > > i have narrowed it down to this piece of code. > > > when i remove it all js works as written.. > > > $(document).ready(function() { > > $('#create_campaign_form').validate({ > > rules: { > > name: {required: true, minlength: 3}, > > startDate: {required: true, date: true}, > > endDate: {required: true, date: true} > > }, > > messages: { > > name: {required: "You must provide a Campaign Name.", > > minlength: "Your Campaign name must be at least 3 characterss long."}, > > startDate: required: "You must provide a start date.", > > endDate: required: "You must provide an end date." > > } > > });}); > > > this piece of validation code causes the js to stop and nothing on the > > page works..But this code does work in the other browsers..ive been > > reading on the trailing comma, but im not seeing where that could be > > faulting.. > > > On Feb 24, 12:35 pm, Bob O wrote: > > > > So im stumped..I have my jquery file in the headers, and it works in > > > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > > > IE..its there, its just broken. > > > > i recently added the validation plugin? > > > > could there be something im missing? > >
[jQuery] Re: $.ajax POST single quote issues...
Well, I can't figure out how to delete this, but there was nothing wrong with the js. Apparently it's my lack of knowledge of php. I needed to write to the db as an escape string and I wasn't. Until next time...
[jQuery] Re: jQuery and IE
messages: { name: { required: "You must provide a Campaign Name.", minlength: "Your Campaign name must be at least 3 characterss long." }, startDate: { required: "You must provide a start date." } endDate: { required: "You must provide an end date." } } On Feb 24, 10:59 am, Bob O wrote: > sorry..new to the group thing here as well... > > i have narrowed it down to this piece of code. > > when i remove it all js works as written.. > > $(document).ready(function() { > $('#create_campaign_form').validate({ > rules: { > name: {required: true, minlength: 3}, > startDate: {required: true, date: true}, > endDate: {required: true, date: true} > }, > messages: { > name: {required: "You must provide a Campaign Name.", > minlength: "Your Campaign name must be at least 3 characterss long."}, > startDate: required: "You must provide a start date.", > endDate: required: "You must provide an end date." > } > });}); > > this piece of validation code causes the js to stop and nothing on the > page works..But this code does work in the other browsers..ive been > reading on the trailing comma, but im not seeing where that could be > faulting.. > > On Feb 24, 12:35 pm, Bob O wrote: > > > So im stumped..I have my jquery file in the headers, and it works in > > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > > IE..its there, its just broken. > > > i recently added the validation plugin? > > > could there be something im missing? > >
[jQuery] Re: New Plugin - jQuery Persistent Client-Side Storage
Documentation and a live demo are available below: http://eric.garside.name/docs.html?p=jstore http://eric.garside.name/demo.html?p=jstore I've only been able to do a full round of testing in Firefox on Linux, so if you've got some time and any other browsers (IE especially), and feel like testing out, any help would be appreciated. I'm 100% positive there's some bugs that need to be worked out, so if you find one, let me know. On Feb 24, 12:04 pm, Eric Garside wrote: > I've just released a new plugin, called jStore, which provides jQuery > with a way to interface with all current and upcoming persistent > client-side storage solutions. This includes google gears, flash > (through SharedObject, or Flash Cookies), local/sessionStorage, the > WHAT_WG HTML5 database, and IE's userData behavior. Right now, I'm > experiencing some DNS issues with my hosting provider, so my > documentation/demo site isn't up, but it should be soon. > > What I'm looking for is some feedback and help testing the engine on > different machines to help identify bugs. If you'd like to give it a > shot or have a look, you can download both the production and > development version, or SVN the source code > fromhttp://code.google.com/p/jquery-jstore > > To use the plugin, you simply include the script: > >
[jQuery] $.ajax POST single quote issues...
Alright, so here's the code I'm using (minus all the fluff): $.ajax({ type: 'POST', url: 'add-item.php', data: 'desc='+ $('#description').val() }); return false; With #description being the id of my input field on the form. Everything works properly except when I throw in a single quote it kills the js. I know why it does, but I haven't been able to find how to fix it. I've search for a few hours now with no luck... any ideas? Thanks in advance for any help.
[jQuery] Re: jQuery and IE
sorry..new to the group thing here as well... i have narrowed it down to this piece of code. when i remove it all js works as written.. $(document).ready(function() { $('#create_campaign_form').validate({ rules: { name: {required: true, minlength: 3}, startDate: {required: true, date: true}, endDate: {required: true, date: true} }, messages: { name: {required: "You must provide a Campaign Name.", minlength: "Your Campaign name must be at least 3 characterss long."}, startDate: required: "You must provide a start date.", endDate: required: "You must provide an end date." } }); }); this piece of validation code causes the js to stop and nothing on the page works..But this code does work in the other browsers..ive been reading on the trailing comma, but im not seeing where that could be faulting.. On Feb 24, 12:35 pm, Bob O wrote: > So im stumped..I have my jquery file in the headers, and it works in > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > IE..its there, its just broken. > > i recently added the validation plugin? > > could there be something im missing?
[jQuery] Superfish menu opacity issue
Hi Joel, First up, great plugin - it's the best I've found. I have a problem though. For some reason my menu appears transparent and no amount of hacking and fixing seemed to do the job. Would you mind telling me how I can make the menu opaque? The transparency of the menu causes it to get in the way of the text beneath it and is causing annoyance with my site's members. The web site is http://www.sydneydragonblades.com if you'd like to see what I'm talking about. Worse still, in my latest re-installation of superfish menu, I seemed to have lost the ability to edit the CSS and JS files and can't seem to change the permissions via an FTP client either... Please help! Albert, Sydney, Australia
[jQuery] Re: please support :target
I think $(window.location.hash) is what you're after here. (https://developer.mozilla.org/en/DOM/window.location) -dan On Feb 24, 8:11 am, brian wrote: > Doesn't this work? > > $('#' + location.target).css('background', > 'url(fade-yellow.gif)').css('font-weight', 'bold'); > > On Tue, Feb 24, 2009 at 9:42 AM, dccrowley wrote: > > >http://www.w3.org/TR/css3-selectors/#target-pseudo > > > :target makes it very easy to style a part of a page that has been > > scrolled to. It is not supported by all browsers but the css rules are > > easy to write. I wish something similar would be possible in jquery. > > > :target { background: url(fade-yellow.gif) font-weight: bold; } > > > MAybe it is possible. I can't find it though.
[jQuery] Inserting text in IE8
My problem isn't strictly jquery but more javaScript. In IE6, 7 i can insert text on a range using pasteHTML(). in IE8 i can only pasteHTML() when text is selected and not when just the cursor is placed. see here for very simple example. http://robing.xtools.co.nz/demo_cms/test_editor/ any idea's why? Robin.
[jQuery] Re: My published plugins are not appearing in the jQuery Plugin list
No problem, Dave. Glad I could help. And congrats on the plugins. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 24, 2009, at 2:57 PM, Dave Stewart wrote: Hooray! That's it sorted. Thanks again Karl :)
[jQuery] UI-sortble lists
I have two sortable lists connected to each other using: $("#listOne").sortable({ connectWith: ["#listTwo"] }); $("#listTwo").sortable({ connectWith: ["#listOne"] }); What I am looking for is a way to select ALL items in the first list and magically move them all into the second list. Essentially a "select all" function. Can anybody help me? Sonia
[jQuery] Re: My published plugins are not appearing in the jQuery Plugin list
Hooray! That's it sorted. Thanks again Karl :)
[jQuery] Multiple XML selector error in IE6 introduced in 1.3.2?
Hi I'm getting an error in IE6 using jQuery 1.3.2 that was not present in 1.3.1. The HTML file is http://www.w3.org/1999/xhtml";> IE6 problem selector $(document).ready(function() { // Set up DOM-ready functions if ($.browser.msie) doc = new ActiveXObject("microsoft.xmldom"); else doc = document.implementation.createDocument("", "", null); doc.async = false; doc.load("test2.xml"); root = doc.documentElement; if (root) { alert($("a", root).length); alert($("b", root).length); alert($("a, b", root).length); } }); and the XML referenced is In Firefox 3 this produces alerts of 1, 2 and 3 as expected. This also happens in IE6 using jQuery 1.3.1, but in 1.3.2 the first two alerts are produced but then an error is generate on the 3rd: Line 16, char 5, 'length' is null or not an object (Line 16 is the multiple selector.) The error occurs whenever there are two or more occurrences of the b- node; it doesn't seem to matter how many a-nodes there are. Alan
[jQuery] Re: jQuery and IE
On Tue, Feb 24, 2009 at 2:35 PM, Bob O wrote: > > So im stumped..I have my jquery file in the headers, and it works in > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > IE..its there, its just broken. We're not getting much, either. Care to elaborate?
[jQuery] Re: jQuery and IE
More info is needed. Either a sample link of it not working or code and versions of files. On Feb 24, 9:35 am, Bob O wrote: > So im stumped..I have my jquery file in the headers, and it works in > Opera, Safari, FF on mac, and FF on Windows, but i get nothing in > IE..its there, its just broken. > > i recently added the validation plugin? > > could there be something im missing?
[jQuery] jQuery and IE
So im stumped..I have my jquery file in the headers, and it works in Opera, Safari, FF on mac, and FF on Windows, but i get nothing in IE..its there, its just broken. i recently added the validation plugin? could there be something im missing?
[jQuery] Re: Plugin hosting?
There is no official cdn for plugins, except for jQuery UI, which is hosted by Google as well --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 24, 2009, at 9:03 AM, Oskar Rough wrote: Hi, I'm really glad it's possible to use the Google hosted jQuery library, however, I see myself using the same plugins over and over again on many different project. Is there any place I can "leech" these plugins like the library? I could put them all up on my own site but I'd prefer something more like the Google hosting.
[jQuery] Re: Stopping emails
ok, I just set your Subscription type to No Email. Let me know if you run into any more problems. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 24, 2009, at 8:37 AM, sunshine gerodias wrote: can anyone also help me with mine? it's flooding my email and i want to stop it On Tue, Feb 24, 2009 at 2:53 PM, ralentango wrote: John Many thanks - that did the trick. I've now joined the Google group and am now in control. And while I'm here ... congratulations for all the great work you've put into jQuery. Alan On Feb 23, 6:17 pm, John Resig wrote: > I just changed your setting to 'No Email'. > > --John > > On Mon, Feb 23, 2009 at 1:15 PM, Alan Williams wrote: > > Hi > > > I currently get all the posts to this group sent to me by email, but > > not because I am a member of the Google group (I must have signed up to the > > emails before the group was set up). I have tried joinng the group, changing > > the settings and unsubscribing, but all to no avail: the emails keep coming. > > > Please can anyone tell me how to unsubscribe to the email feed? > > > Alan
[jQuery] Css Background-Position and Internet Explorer 7
Dear group, I made a simple website using html, css and jquery. There are four div's that divide the website in different parts and if your scroll position reach them they start to scroll their background image using css() http://variouselmts.com/development/ It works on a mac and also on a pc with opera and firefox but unfortunately not with Internet Explorer 7. Since I have no own pc, I really need you help in debugging this Many thanks
[jQuery] Weird problem with slideToggle() in Firefox
I am making a form with optional fieldsets. The idea is to dynamically apply a style to the headings above only the optional fieldsets and allow this "controller" style to expand and contract the "optional" div below it on click. Here is a snippet of my markup: **begin markup snippet** ... Key Project Information Your Name Project Name Deadline Date Additional Information Your Dog's Name Another Field ... **end markup snippet** and here is my jQuery code **begin code** $(document).ready(function(){ // hide all elements tagged as optional // add a class of controller (that has a plus sign, indicating expandable) $(".optional").hide().prev().addClass("controller"); // when user clicks on controller class toggle it to "open" or not (this changes + to -) // and the next optional class below it is triggered to open or close $(".controller").click(function(){ $(this).toggleClass("open").next(".optional").slideToggle("slow"); }); }); **end code** OK, here is the weird thing. This works fine on Firefox 3.0.6 and IE7 on Windows if I use "jquery-1.2.6.min.js" but it breaks only on Firefox if I use "jquery-1.3.2.min.js".. on Firefox the problem is that the .slideToggle() doesn't seem to ever recognize that the "optional" div is open.. it keeps sliding open but not closed.. why is this happening? I have gone through every possible iteration on removing parts of the code and rebuilding and I still have no inkling as to what I've done wrong here. I'm trying to use as little markup as possible and make sure it degrades gracefully. Please be gentle and try to explain the "why" of what the correct logic is; I went to art school! Thanks in advance for your help.
[jQuery] Re: Order Items. Please help me. Thank You.
@Michael, I just installed Firebug and I almost made this working. The only problem I have is when I am adding the levels to the list as html and as hidden input: +friendlyLevels(t[1].text.join(', '))+'' $('').attr({'type':'hidden','name':'Themes['+i +'].LevelCsv'}).val(t[1].value.join()).appendTo(li); I get an error in Firebug: t[1].text is undefined [Break on this error] +friendlyLevels(t[1].text.join(', '))+'' But as far as I know to get the text and value I use .text and .value. My friendlyLevels function is function friendlyLevels(levels) { if (levels.length < 2) return levels.join(''); var first = levels.slice(0, -1), last = levels.slice(-1); var friendly = first.join(', '); if (last) { friendly += ' e ' + last; } return friendly; } I am trying to display a join of the values in the hidden input and a join of the texts in the html but using friendlyLevels or anything similar to add the "e" at the end. I removed your code just because it was adding the "e" only for 3 items and using a function makes the code less confusing. I updated my code in: http://www.27lamps.com/Beta/List/List5.html I plan to optimize my code but first I would like to make it work so I can optimize it step by step. @seasoup I didn't forgot the problems you mentioned about using [] ... But what would you suggest to replace []? I can post the suggestion on ASP.NET MVC forums where I participate on a daily basis. I am using Microsoft ASP.NET MVC which gives me complete control of the HTML but still allows me to use C# and SQL. Microsoft ASP.NET MVC ships now with JQuery since there was a partnership created between JQuery creators and Microsoft. This is the reason why I am starting with JQuery but I am still learning ... but until now it seams great. Thanks, Miguel http://www.27lamps.com/Beta/List/List5.html On Feb 24, 4:57 pm, mkmanning wrote: > Creating a complete html string won't solve the current problem; it is > faster, and usually the way I prefer doing it also (see my note > further below though), but as I indicated in a code comment, since > this appears to be based on user input, the list (hopefully) won't be > very big, so the speed gain probably isn't appreciable. > > @Shapper - get Firebug and use Firefox for debugging, it will tell you > immediately that you have an error in your code: you define levelCsv = > [] but then use levelsCsv for the array.push() > > Once you get it working you can try seasoups suggestion for a speed > improvement if you like (or simply for your own edification); it will > definitely benefit you in future if you work with larger lists or > blocks of html. An even more important performance gain can be had by > not doing string concatenation (I put a caveat about this in the code > comment's also), but build an array of your html and then join the > array; it's siginficantly faster. Check the forum and you'll see > examples of this. > > On Feb 24, 8:23 am, seasoup wrote: > > > Hi Miguel, not sure if it will solve your problem, but I find it is > > much faster to create a complete html string and then append it > > instead of doing lots of appends, which are slow. > > > //this handles the li content > > var li = > > $('').addClass('Themes').html(t[0].text+'' > > +friendlyLevels(t[1])+'' > > +(t[2]==''?'':t[2]+'') > > +' > class="Remove">Remove' > > ).appendTo(ol); > > //now the inputs, this could also be done > > in another loop with an > > array of names, if it gets longer; and the brackets in the name are > > still a bad idea > > > > $('').attr({'type':'hidden','name':'Themes['+i > > +'].Subject'}).val(t[0].value).appendTo(li); > > > > $('').attr({'type':'hidden','name':'Themes['+i > > +'].LevelCsv'}).val(t[1].join()).appendTo(li); > > > > $('').attr({'type':'hidden','name':'Themes['+i > > +'].Note'}).val(t[2]).appendTo(li); > > > is faster as > > > var html = ' + t[0].text + " + friendlyLevels > > (t[1]) + '' + (t[2]==''?'':t[2]+'') + ' > class="Remove">Remove + > > ' + > > ' + > > '; > > > $(ol).append(html); // or $(html).appendTo(ol); > > > On Feb 24, 7:33 am, shapper wrote: > > > > Hi, > > > > I think I did that ... > > > > I have this example working with Subjects and FriendlyLevels function > > > to add the "e" correctly:http://www.27lamps.com/Beta/List/List4.html > > > > Then I tried to do the same but for > > > levels:http://www.27lamps.com/Beta/List/List5.html > > > > But I keep having errors. > > > > What am I missing? > > > > Sorry, but I am just starting with JQuery. > > > > Thank You, > > > Miguel > > > > On Feb 23, 9:23 pm, mkmanning wrote: > > > > > That's because you changed leve
[jQuery] Re: Validation Plugin: Too Much Recursion
Here's hoping the next one finds this: http://docs.jquery.com/Plugins/Validation#Too_much_recursion Jörn On Tue, Feb 24, 2009 at 7:01 PM, kevinm wrote: > > Ah, makes total sense. Thanks > > On Feb 24, 1:01 pm, Jörn Zaefferer > wrote: >> $(form).submit() triggers another round of validation, resulting in >> another call to submitHandler, and voila,recursion. Replace that with >> form.submit(), which triggers the native submit event instead and not >> the validation. >> >> Jörn >> >> On Tue, Feb 24, 2009 at 4:58 PM, kevinm wrote: >> >> > James, >> >> > We just ran into the same issue. In my case we are opening a modal >> > window with nyroModal. Here is thevalidatefunction. >> >> > var myValidate = $("#myform").validate({ >> > ignoreTitle: true, >> > focusCleanup: false, >> > ignoreTitle: true, >> > debug: true, >> > onfocusout: false, >> > submitHandler: function(form) { >> > // do other stuff for a valid form >> > $(form).submit(); >> > parent.$.nyroModalRemove(); return false; >> > }, >> > rules: { >> > with_req_request_date: { >> > required: true, >> > date:true >> > }, >> > with_req_request_type: { >> > required: true >> > }, >> > withdrawal_reason_id: { >> > required: true >> > }, >> > case_note: { >> > required: true >> > } >> > }, >> >> > messages: { >> > with_req_request_date: "Please enter the date in proper >> > 'mm/dd/' format", >> > with_req_request_type: "Please select the request type", >> > withdrawal_reason_id: "Please select the >> > withdrawal reason", >> > case_note: "Please enter the case note" >> > } >> >> > // } ) >> >> > }) //End ofvalidate >> >> > What I did notice if that I do not do the form.submit inside the >> > submit handler therecursiondoes not occur. Not sure if that helps. >> > Also in this case this is the onlyvalidatecall. >> >> > Kevin >> >> > On Feb 9, 1:19 am, James wrote: >> >> Since you can't show any code, with only what I see there should not >> >> be any issues... >> >> That is, there is no issue with using twovalidatefunctions on two >> >> different forms, each with it's own set of rules. >> >> >> You're going to have to show more code for us to get to down to the >> >> issue. >> >> >> On Feb 8, 5:54 pm, Cutter wrote: >> >> >> > I have an odd thing happening with the Validation Plugin (latest build >> >> > on JQuery 1.3). I have several forms setup on a page, with validation >> >> > on two. My first works fine, but my second keeps giving me errors in >> >> > Firebug about 'too muchrecursion'. The configs for these two form >> >> > validations are nearly identical, with the exception of the rules and >> >> > messages, which are very basic field-is-requirewswwd kinda stuff. Some >> >> > searching on the web shows me that there used to be a ticket on this >> >> > (#2995), but that it was closed without fix. >> >> >> > I have stripped down my second form'svalidatemethod (the one that is >> >> > erroring) to the barest of validation scripts, and can not get by it >> >> > for the life of me. The configs each set avalidate() method on a >> >> > separate form. >> >> >> > $('#frm1').validate({ >> >> > // config here >> >> >> > } >> >> >> > $('#frm2').validate({ >> >> > // second config here >> >> >> > } >> >> >> > I am getting nowhere. Anyone? >> >> >> > (BTW, I can't post the code, or show you a form, because it's all >> >> > behind the firewall)
[jQuery] Re: Animate Delay Issue
I just watched a couple of videos on Ajaxian.com where John Resig was talking about chaining, but it didn't sink it. Thanks for the help. My animation works great now. On Feb 24, 5:35 am, Stephan Veigl wrote: > Hi Wolf, > > try to stop previous animations before adding a new one: > $(this).stop().animate({...}); > > by(e) > Stephan > > 2009/2/24 Wolf : > > > > > I have a strange delay issue. > > > I'm working on a menu animation. When a user moves their mouse to the > > top, it will move the menu up and when they move their mouse to the > > bottom, it moves it down. When I first move the mouse over the menu, > > the animation fires. But there is a big delay (maybe 2 seconds) > > before it will fire again, after I move my mouse back on it. > > > However, if I change the animation speed from 2000 milliseconds to 10 > > milliseconds, it will fire right away. > > > Any Suggestions? Thx. > > > Here is a simplified version of my code: > > $("#menu").mousemove(function(e){ > > if (e.pageY < 100) { > > $(this).animate({ > > top: "-200px" > > }, 2000 ); > > } > > if (e.pageY > 300) { > > $(this).animate({ > > top: "0px" > > }, 2000 ); > > } > > });
[jQuery] Re: please support :target
Must try this. Thank you for the tip On Feb 24, 5:11 pm, brian wrote: > Doesn't this work? > > $('#' + location.target).css('background', > 'url(fade-yellow.gif)').css('font-weight', 'bold'); > > On Tue, Feb 24, 2009 at 9:42 AM, dccrowley wrote: > > >http://www.w3.org/TR/css3-selectors/#target-pseudo > > > :target makes it very easy to style a part of a page that has been > > scrolled to. It is not supported by all browsers but the css rules are > > easy to write. I wish something similar would be possible in jquery. > > > :target { background: url(fade-yellow.gif) font-weight: bold; } > > > MAybe it is possible. I can't find it though.
[jQuery] Re: please support :target
Thank you! On Feb 24, 5:31 pm, seasoup wrote: > It is possible to write your own selectors. There are a bunch of > tutorials around the web. > > here is > one:http://www.coderanch.com/t/121354/HTML-JavaScript/Writing-custom-JQue... > > and here is > another:http://www.bennadel.com/blog/1457-How-To-Build-A-Custom-jQuery-Select... > > Hope they help! > > On Feb 24, 6:42 am, dccrowley wrote: > > >http://www.w3.org/TR/css3-selectors/#target-pseudo > > > :target makes it very easy to style a part of a page that has been > > scrolled to. It is not supported by all browsers but the css rules are > > easy to write. I wish something similar would be possible in jquery. > > > :target { background: url(fade-yellow.gif) font-weight: bold; } > > > MAybe it is possible. I can't find it though.
[jQuery] Re: Validation Plugin: Too Much Recursion
Ah, makes total sense. Thanks On Feb 24, 1:01 pm, Jörn Zaefferer wrote: > $(form).submit() triggers another round of validation, resulting in > another call to submitHandler, and voila,recursion. Replace that with > form.submit(), which triggers the native submit event instead and not > the validation. > > Jörn > > On Tue, Feb 24, 2009 at 4:58 PM, kevinm wrote: > > > James, > > > We just ran into the same issue. In my case we are opening a modal > > window with nyroModal. Here is thevalidatefunction. > > > var myValidate = $("#myform").validate({ > > ignoreTitle: true, > > focusCleanup: false, > > ignoreTitle: true, > > debug: true, > > onfocusout: false, > > submitHandler: function(form) { > > // do other stuff for a valid form > > $(form).submit(); > > parent.$.nyroModalRemove(); return false; > > }, > > rules: { > > with_req_request_date: { > > required: true, > > date:true > > }, > > with_req_request_type: { > > required: true > > }, > > withdrawal_reason_id: { > > required: true > > }, > > case_note: { > > required: true > > } > > }, > > > messages: { > > with_req_request_date: "Please enter the date in proper > > 'mm/dd/' format", > > with_req_request_type: "Please select the request type", > > withdrawal_reason_id: "Please select the > > withdrawal reason", > > case_note: "Please enter the case note" > > } > > > // } ) > > > }) //End ofvalidate > > > What I did notice if that I do not do the form.submit inside the > > submit handler therecursiondoes not occur. Not sure if that helps. > > Also in this case this is the onlyvalidatecall. > > > Kevin > > > On Feb 9, 1:19 am, James wrote: > >> Since you can't show any code, with only what I see there should not > >> be any issues... > >> That is, there is no issue with using twovalidatefunctions on two > >> different forms, each with it's own set of rules. > > >> You're going to have to show more code for us to get to down to the > >> issue. > > >> On Feb 8, 5:54 pm, Cutter wrote: > > >> > I have an odd thing happening with the Validation Plugin (latest build > >> > on JQuery 1.3). I have several forms setup on a page, with validation > >> > on two. My first works fine, but my second keeps giving me errors in > >> > Firebug about 'too muchrecursion'. The configs for these two form > >> > validations are nearly identical, with the exception of the rules and > >> > messages, which are very basic field-is-requirewswwd kinda stuff. Some > >> > searching on the web shows me that there used to be a ticket on this > >> > (#2995), but that it was closed without fix. > > >> > I have stripped down my second form'svalidatemethod (the one that is > >> > erroring) to the barest of validation scripts, and can not get by it > >> > for the life of me. The configs each set avalidate() method on a > >> > separate form. > > >> > $('#frm1').validate({ > >> > // config here > > >> > } > > >> > $('#frm2').validate({ > >> > // second config here > > >> > } > > >> > I am getting nowhere. Anyone? > > >> > (BTW, I can't post the code, or show you a form, because it's all > >> > behind the firewall)
[jQuery] Validation and Facebox
Hello, Ive been using the Validation plugin on my site and it works fantastic. i have run into an issue with trying to get it to perform validation on a form that resides in a facebox. I setup the validation the same as any other form in the site. what could i be missing?
[jQuery] Re: validation rules("remove") doesn't seem to work
Actually I think it is working - I h=just wasn't removing the lable withthe onclick thanks On Feb 24, 5:34 pm, kathb4 wrote: > I am trying to use the validation plugin to validate a set of > checkboxes which are created by my CMS (drupal) so are not changeable > - and which look like this: > > > >class="form-checkbox" /> a. Tanks (Oil, fuel chemicals) > > > b. Rubbish > ... > > > I want the user to select at least one of the pollutant checkboxes. > As you can see the name is in the format pollutants[]. > > I don't want to have to validate each option, cause I want them only > to have to choose one of the pollutants. I tried "pollutans[]" but > that didn't work. > > So now I'm trying to do it by doing a combination of things > 1. putting a required on the first one if count of checkboxes.size()== > 0 > 2. looking for an onclick to remove the rule if any of the checkboxes > are then checked. > > But the remove rule is not working. > > > $("inp...@name^='pollutants']").change(function(){ >$("inp...@name^='pollutants']").rules("remove"); > }); > > $("#myForm").validate({ > rules: { > "pollutants[tanks]": "required" > } > }); > > > Any suggestions? I am rather frustrated.
[jQuery] Re: validation rules("remove") doesn't seem to work
Im a little new to the plugin myself, but do you have a wrote: > I am trying to use the validation plugin to validate a set of > checkboxes which are created by my CMS (drupal) so are not changeable > - and which look like this: > > > > class="form-checkbox" /> a. Tanks (Oil, fuel chemicals) > > > b. Rubbish > ... > > > I want the user to select at least one of the pollutant checkboxes. > As you can see the name is in the format pollutants[]. > > I don't want to have to validate each option, cause I want them only > to have to choose one of the pollutants. I tried "pollutans[]" but > that didn't work. > > So now I'm trying to do it by doing a combination of things > 1. putting a required on the first one if count of checkboxes.size()== > 0 > 2. looking for an onclick to remove the rule if any of the checkboxes > are then checked. > > But the remove rule is not working. > > > $("inp...@name^='pollutants']").change(function(){ > $("inp...@name^='pollutants']").rules("remove"); > }); > > $("#myForm").validate({ > rules: { > "pollutants[tanks]": "required" > } > }); > > > Any suggestions? I am rather frustrated.
[jQuery] validation rules("remove") doesn't seem to work
I am trying to use the validation plugin to validate a set of checkboxes which are created by my CMS (drupal) so are not changeable - and which look like this: a. Tanks (Oil, fuel chemicals) b. Rubbish ... I want the user to select at least one of the pollutant checkboxes. As you can see the name is in the format pollutants[]. I don't want to have to validate each option, cause I want them only to have to choose one of the pollutants. I tried "pollutans[]" but that didn't work. So now I'm trying to do it by doing a combination of things 1. putting a required on the first one if count of checkboxes.size()== 0 2. looking for an onclick to remove the rule if any of the checkboxes are then checked. But the remove rule is not working. $("inp...@name^='pollutants']").change(function(){ $("inp...@name^='pollutants']").rules("remove"); }); $("#myForm").validate({ rules: { "pollutants[tanks]": "required" } }); Any suggestions? I am rather frustrated.
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
Liam, I think you're thinking of $("p, #foo"). Notice it's the difference between two params being passed in to the selector function (the original question) vs a single param that happens to be a comma separated list of selectors. On Feb 24, 6:00 am, Liam Potter wrote: > lol, but I'm interested in what jquery does with what I tell it. > > jQuery Lover wrote: > > That is how it works Liam !!! jQuery does not knows, it's told so... > > > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > On Tue, Feb 24, 2009 at 6:49 PM, Liam Potter > > wrote: > > >> ok, but what in jquery knows that $("p", $("#foo")) should look for the p > >> tags inside of #foo, why does it treat it like $("#foo p")? > > >> jQuery Lover wrote: > > >>> Liam, you can use $("p", "#foo"). The second parameter must be a > >>> jQuery object or dom element... > > >>> > >>> Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > >>> On Tue, Feb 24, 2009 at 6:44 PM, Liam Potter > >>> wrote: > > Hi Stehpan :p > > I understand that, I'm just not sure why $("p", $("#foo")) is not the > same > as $("p", "#foo") > > - Liam > > Stephan Veigl wrote: > > > Hi Lima, > > > 1) #foo is an ID and since IDs should be unique there has to bee only > > one #foo element > > > 2) $("p", $("#foo")) selects all elements in the scope of the #foo > > element. > > In other words, it selects every element under #foo in the DOM tree. > > > by(e) > > Stephan > > > 2009/2/24 Liam Potter : > > >> I've been following this discussion, but I need explaining why $("p", > >> $("#foo")) doesn't select all p tags and all #foo id's ? > > >> Stephan Veigl wrote: > > >>> Hi, > > >>> I've done some profiling on this, and $("p", $("#foo")) is faster than > >>> $("#foo p") in both jQuery 1.2.6 and 1.3.2. > > >>> the test HTML consists of 100 s in a "foo" and 900 s in a > >>> "bar" . > > >>> However the factor differs dramatically: > >>> In 1.2.6 the speedup from $("p", $("#foo")) to $("#foo p") was between > >>> 1.5x (FF) and 2x (IE), > >>> while for 1.3.2 the speedup is 20x (FF) and 15x (IE). > > >>> $("p", $("#foo")) is faster in 1.3.2, by a factor of 1.5 (both FF and > >>> IE), > >>> while $("#foo p") is _slower_ in 1.3.2 by 8.5x (FF) and 4.6x (IE). > > >>> Even with an empty "bar" div $("p", $("#foo")) is faster by a factor > >>> up > >>> to > >>> 3x. > > >>> Conclusion: > >>> If you have an ID selector, first get the element by it's ID and use > >>> it as scope for further selects. > > >>> by(e) > >>> Stephan > >>> 2009/2/23 ricardobeat : > > up to jQuery 1.2.6 that's how the selector engine worked (from the > top > down/left to right). The approach used in Sizzle (bottom up/right to > left) has both benefits and downsides - it can be much faster on > large > DOMs and some situations, but slower on short queries. I'm sure > someone can explain that in better detail. > > Anyway, in modern browsers most of the work is being delegated to the > native querySelectorAll function, as so selector performance will > become more of a browser makers' concern. > > - ricardo > > On Feb 23, 1:08 pm, Peter Bengtsson wrote: > > > I watched the John Resig presentation too and learned that CSS > > selectors always work from right to left. > > That would mean that doing this:: > > > $('#foo p') > > > Would extract all tags and from that list subselect those who > > belong to #foo. Suppose you have 1000 tags of them only 100 are > > inside #foo you'll have wasted 900 loops. > > > Surely $('#foo') is the fastest lookup possible. Doing it this way > > will effectively limit the scope of the $('p') search and you will > > never be bothered about any tags outside #foo. > > > Or am I talking rubbish?
[jQuery] New Plugin - jQuery Persistent Client-Side Storage
I've just released a new plugin, called jStore, which provides jQuery with a way to interface with all current and upcoming persistent client-side storage solutions. This includes google gears, flash (through SharedObject, or Flash Cookies), local/sessionStorage, the WHAT_WG HTML5 database, and IE's userData behavior. Right now, I'm experiencing some DNS issues with my hosting provider, so my documentation/demo site isn't up, but it should be soon. What I'm looking for is some feedback and help testing the engine on different machines to help identify bugs. If you'd like to give it a shot or have a look, you can download both the production and development version, or SVN the source code from http://code.google.com/p/jquery-jstore To use the plugin, you simply include the script:
[jQuery] Re: Validation Plugin: Too Much Recursion
$(form).submit() triggers another round of validation, resulting in another call to submitHandler, and voila, recursion. Replace that with form.submit(), which triggers the native submit event instead and not the validation. Jörn On Tue, Feb 24, 2009 at 4:58 PM, kevinm wrote: > > James, > > We just ran into the same issue. In my case we are opening a modal > window with nyroModal. Here is the validate function. > > var myValidate = $("#myform").validate({ > ignoreTitle: true, > focusCleanup: false, > ignoreTitle: true, > debug: true, > onfocusout: false, > submitHandler: function(form) { > // do other stuff for a valid form > $(form).submit(); > parent.$.nyroModalRemove(); return false; > }, > rules: { > with_req_request_date: { > required: true, > date:true > }, > with_req_request_type: { > required: true > }, > withdrawal_reason_id: { > required: true > }, > case_note: { > required: true > } > }, > > messages: { > with_req_request_date: "Please enter the date in proper > 'mm/dd/' format", > with_req_request_type: "Please select the request type", > withdrawal_reason_id: "Please select the > withdrawal reason", > case_note: "Please enter the case note" > } > > // } ) > > }) //End of validate > > What I did notice if that I do not do the form.submit inside the > submit handler the recursion does not occur. Not sure if that helps. > Also in this case this is the only validate call. > > Kevin > > On Feb 9, 1:19 am, James wrote: >> Since you can't show any code, with only what I see there should not >> be any issues... >> That is, there is no issue with using twovalidatefunctions on two >> different forms, each with it's own set of rules. >> >> You're going to have to show more code for us to get to down to the >> issue. >> >> On Feb 8, 5:54 pm, Cutter wrote: >> >> > I have an odd thing happening with the Validation Plugin (latest build >> > on JQuery 1.3). I have several forms setup on a page, with validation >> > on two. My first works fine, but my second keeps giving me errors in >> > Firebug about 'too muchrecursion'. The configs for these two form >> > validations are nearly identical, with the exception of the rules and >> > messages, which are very basic field-is-requirewswwd kinda stuff. Some >> > searching on the web shows me that there used to be a ticket on this >> > (#2995), but that it was closed without fix. >> >> > I have stripped down my second form'svalidatemethod (the one that is >> > erroring) to the barest of validation scripts, and can not get by it >> > for the life of me. The configs each set avalidate() method on a >> > separate form. >> >> > $('#frm1').validate({ >> > // config here >> >> > } >> >> > $('#frm2').validate({ >> > // second config here >> >> > } >> >> > I am getting nowhere. Anyone? >> >> > (BTW, I can't post the code, or show you a form, because it's all >> > behind the firewall)
[jQuery] Re: Order Items. Please help me. Thank You.
Creating a complete html string won't solve the current problem; it is faster, and usually the way I prefer doing it also (see my note further below though), but as I indicated in a code comment, since this appears to be based on user input, the list (hopefully) won't be very big, so the speed gain probably isn't appreciable. @Shapper - get Firebug and use Firefox for debugging, it will tell you immediately that you have an error in your code: you define levelCsv = [] but then use levelsCsv for the array.push() Once you get it working you can try seasoups suggestion for a speed improvement if you like (or simply for your own edification); it will definitely benefit you in future if you work with larger lists or blocks of html. An even more important performance gain can be had by not doing string concatenation (I put a caveat about this in the code comment's also), but build an array of your html and then join the array; it's siginficantly faster. Check the forum and you'll see examples of this. On Feb 24, 8:23 am, seasoup wrote: > Hi Miguel, not sure if it will solve your problem, but I find it is > much faster to create a complete html string and then append it > instead of doing lots of appends, which are slow. > > //this handles the li content > var li = > $('').addClass('Themes').html(t[0].text+'' > +friendlyLevels(t[1])+'' > +(t[2]==''?'':t[2]+'') > +'Remove' > ).appendTo(ol); > //now the inputs, this could also be done in > another loop with an > array of names, if it gets longer; and the brackets in the name are > still a bad idea > > $('').attr({'type':'hidden','name':'Themes['+i > +'].Subject'}).val(t[0].value).appendTo(li); > > $('').attr({'type':'hidden','name':'Themes['+i > +'].LevelCsv'}).val(t[1].join()).appendTo(li); > > $('').attr({'type':'hidden','name':'Themes['+i > +'].Note'}).val(t[2]).appendTo(li); > > is faster as > > var html = ' + t[0].text + " + friendlyLevels > (t[1]) + '' + (t[2]==''?'':t[2]+'') + ' class="Remove">Remove + > ' + > ' + > '; > > $(ol).append(html); // or $(html).appendTo(ol); > > On Feb 24, 7:33 am, shapper wrote: > > > Hi, > > > I think I did that ... > > > I have this example working with Subjects and FriendlyLevels function > > to add the "e" correctly:http://www.27lamps.com/Beta/List/List4.html > > > Then I tried to do the same but for > > levels:http://www.27lamps.com/Beta/List/List5.html > > > But I keep having errors. > > > What am I missing? > > > Sorry, but I am just starting with JQuery. > > > Thank You, > > Miguel > > > On Feb 23, 9:23 pm, mkmanning wrote: > > > > That's because you changed levels to an object, which you don't need > > > to. Just use the original var levels = $('input:checkbox:checked'), > > > and then > > > levels.each(function(){ > > > levelsCsv.push({'text':this.value,'value':$ > > > (this).next().text()}) > > > }) > > > > On Feb 23, 9:37 am, shapper wrote: > > > > > Hello, > > > > > I tried to make the change: > > > > levels.each(function(){ > > > > > > > > levelsCsv.push({'text':this.value,'value':$(this).next().text()}) > > > > }) > > > > > But I get an error on Firebug: > > > > levels.each is not a function > > > > > Am I doing something wrong? > > > > > I also made a change on buildThemesList to use text and also to fix > > > > the problem on your code that adds "e" only when there are 3 items. It > > > > should be also applied when there are 2: > > > > > $.each(themes,function(i,t){ > > > > var li = $('').addClass('Themes').html(t[0].text+'' > > > > +friendlyLevels(t[1].text)+'' > > > > +(t[2]==''?'':t[2]+'') > > > > +'Remover' > > > > ).appendTo(ol); > > > > > function friendlyLevels(levels) { > > > > if (levels.length < 2) return levels.join(''); > > > > var first = levels.slice(0, -1), last = levels.slice(-1); > > > > var friendly = first.join(', '); > > > > if (last) { friendly += ' e ' + last; } > > > > return friendly; > > > > } > > > > > I am not completely sure that I am doing this right because I get the > > > > error before. > > > > > Thank You, > > > > Miguel > > > > On Feb 20, 5:02 pm, mkmanning wrote: > > > > > > levels.text = $('input[name="Levels"]:checked + label'); > > > > > levels.value = $('input[name="Levels"]:checked'); > > > > > > Those don't get you the right values for the levels object, they both > > > > > return a jQuery object. > > > > > Accessing the levels object as this.value won't work either. > > > > > > Try this: > > > > > > levels.each(function(){ > > > > > levelsCsv.push({'text':
[jQuery] Re: preventing redirection when opening modal dialog box
Yep I am. I event tried event.stopPropagation() but still the same thing. Can I say I hate IE? On Feb 24, 10:26 am, Hector Virgen wrote: > Are you passing the event to the function? > $("#btnAddSession").click(function(event){ > // ... // > event.preventDefault();}); > > -Hector > > On Tue, Feb 24, 2009 at 6:48 AM, bittermonkey wrote: > > > Steve, yes I did try to use , , and > > but to no success. > > > Hector, it still does the same thing even with the preventDefault() > > method in place. > > > On Feb 23, 11:43 pm, Hector Virgen wrote: > > > Try preventing the default action of the event: > > > $("#btnAddSession").click(function(event){ > > > $("#addproductsForm").dialog("open"); > > > event.preventDefault(); // prevents the link from being followed > > > > }); > > > > -Hector > > > > On Mon, Feb 23, 2009 at 7:01 PM, Steven Yang > > wrote: > > > > have you tried changing the type of btnAddSession from submit to > > button?
[jQuery] Re: Superfish Submenus Appear Under Slideshow Pro
I was able to get this working. What it turned out to be was the special plugin I was using in Expression Engine to post flash files didn't support the wmode parameter. To get around it I manually embedded the file and it worked perfectly. If anyone is interested, I looked into a better Expression Engine flash plugin and I was able to find FLV Media Player (http://www. 5pieces.com/blog/flv-player-plugin-v4/).
[jQuery] Re: please support :target
It is possible to write your own selectors. There are a bunch of tutorials around the web. here is one: http://www.coderanch.com/t/121354/HTML-JavaScript/Writing-custom-JQuery-Selectors and here is another: http://www.bennadel.com/blog/1457-How-To-Build-A-Custom-jQuery-Selector.htm Hope they help! On Feb 24, 6:42 am, dccrowley wrote: > http://www.w3.org/TR/css3-selectors/#target-pseudo > > :target makes it very easy to style a part of a page that has been > scrolled to. It is not supported by all browsers but the css rules are > easy to write. I wish something similar would be possible in jquery. > > :target { background: url(fade-yellow.gif) font-weight: bold; } > > MAybe it is possible. I can't find it though.
[jQuery] Re: Images in Superfish Menus
Do you have an example page? On Tue, Feb 24, 2009 at 10:20 AM, alsag...@gmail.com wrote: > > Yes. I placed a background-image in just about every CSS rule I > thought would work, and nothing has worked. For example, this is the > last one I tried: > .sf-menu li { >float: left; >position: relative; >background-color: #BDD2FF; >background-image: url(images/brb.png); >background-repeat: repeat-x; >background-position: 0 0; > } > > On Feb 24, 8:54 am, jQuery Lover wrote: > > Did you try to mess around with superfish css files ? > > > > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > > On Tue, Feb 24, 2009 at 12:54 PM, alsag...@gmail.com > wrote: > > > > > I am new to Joomla but have a decent understanding of CSS. > > > > > I am trying to figure out how to use images in a Superfish menue (even > > > if it's just a background image) but I'm completely lost. I've tried > > > inserting background images into dffierent parts of the CSS, to no > > > avail. I've tried what I thought was an image area in the Joomla > > > backend module window (under "other parameters"), but no dice there > > > either. > > > > > Please let me know if it is possible or not, and if so, how to go > > > about doing it! > > > > > Thank you! >
[jQuery] Re: Order Items. Please help me. Thank You.
Hi Miguel, not sure if it will solve your problem, but I find it is much faster to create a complete html string and then append it instead of doing lots of appends, which are slow. //this handles the li content var li = $('').addClass('Themes').html(t[0].text+'' +friendlyLevels(t[1])+'' +(t[2]==''?'':t[2]+'') +'Remove' ).appendTo(ol); //now the inputs, this could also be done in another loop with an array of names, if it gets longer; and the brackets in the name are still a bad idea $('').attr({'type':'hidden','name':'Themes['+i +'].Subject'}).val(t[0].value).appendTo(li); $('').attr({'type':'hidden','name':'Themes['+i +'].LevelCsv'}).val(t[1].join()).appendTo(li); $('').attr({'type':'hidden','name':'Themes['+i +'].Note'}).val(t[2]).appendTo(li); is faster as var html = ' + t[0].text + " + friendlyLevels (t[1]) + '' + (t[2]==''?'':t[2]+'') + 'Remove + ' + ' + '; $(ol).append(html); // or $(html).appendTo(ol); On Feb 24, 7:33 am, shapper wrote: > Hi, > > I think I did that ... > > I have this example working with Subjects and FriendlyLevels function > to add the "e" correctly:http://www.27lamps.com/Beta/List/List4.html > > Then I tried to do the same but for > levels:http://www.27lamps.com/Beta/List/List5.html > > But I keep having errors. > > What am I missing? > > Sorry, but I am just starting with JQuery. > > Thank You, > Miguel > > On Feb 23, 9:23 pm, mkmanning wrote: > > > That's because you changed levels to an object, which you don't need > > to. Just use the original var levels = $('input:checkbox:checked'), > > and then > > levels.each(function(){ > > levelsCsv.push({'text':this.value,'value':$ > > (this).next().text()}) > > }) > > > On Feb 23, 9:37 am, shapper wrote: > > > > Hello, > > > > I tried to make the change: > > > levels.each(function(){ > > > > > > levelsCsv.push({'text':this.value,'value':$(this).next().text()}) > > > }) > > > > But I get an error on Firebug: > > > levels.each is not a function > > > > Am I doing something wrong? > > > > I also made a change on buildThemesList to use text and also to fix > > > the problem on your code that adds "e" only when there are 3 items. It > > > should be also applied when there are 2: > > > > $.each(themes,function(i,t){ > > > var li = $('').addClass('Themes').html(t[0].text+'' > > > +friendlyLevels(t[1].text)+'' > > > +(t[2]==''?'':t[2]+'') > > > +'Remover' > > > ).appendTo(ol); > > > > function friendlyLevels(levels) { > > > if (levels.length < 2) return levels.join(''); > > > var first = levels.slice(0, -1), last = levels.slice(-1); > > > var friendly = first.join(', '); > > > if (last) { friendly += ' e ' + last; } > > > return friendly; > > > } > > > > I am not completely sure that I am doing this right because I get the > > > error before. > > > > Thank You, > > > Miguel > > > On Feb 20, 5:02 pm, mkmanning wrote: > > > > > levels.text = $('input[name="Levels"]:checked + label'); > > > > levels.value = $('input[name="Levels"]:checked'); > > > > > Those don't get you the right values for the levels object, they both > > > > return a jQuery object. > > > > Accessing the levels object as this.value won't work either. > > > > > Try this: > > > > > levels.each(function(){ > > > > levelsCsv.push({'text':this.value,'value':$(this).next().text()}) > > > > > }) > > > > > On Feb 20, 5:22 am, shapper wrote: > > > > > > Hi, > > > > > > I followed your tips but I still have a few problems. > > > > > The subject is working fine but when I do the same to the levels it > > > > > does not work. > > > > > > I think the problem, but I am not sure, is in: > > > > > levels.each(function(){ > > > > > levelCsv.push(this.value);//array to hold the levels > > > > > }); > > > > > > I changed everything else. I updated my > > > > > example:http://www.27lamps.com/Beta/List/List3.html > > > > > > Other problem I notice is that when two levels are added the word "e" > > > > > is not added between the both. > > > > > Only when 3 levels are added. On my first example I had a function > > > > > that was doing it:http://www.27lamps.com/Beta/List/List.html > > > > > > I just don't know how to integrate this on your code. > > > > > I don't need to use my FriendlyLevels example. I just need to have the > > > > > "e" every time there is more then 1 level. > > > > > > How can I do it? > > > > > > Thank You, > > > > > Miguel > > > > > > - The subject is working fine. > > > > > - > > > > > > On Feb 20, 1:50 am, mkmanning wrote: > > > > > > > You could m
[jQuery] Problems with alphanumeric plugin
Hi! i need some help with alphanumeric plugin. I have a couple of inputs that i want to only permit numbers to be write there, so i´m using this plugin, but the problem is that i can only prevent user from enetering characters non numeric in the first input, but nothing happens with the others... i am using something like this: $("#TestcollectorUrl").numeric(); $("#TestTestInterval").numeric(); $("#TestcollectorTimeout").numeric(); . . . . any ideas are welcome! thanks!
[jQuery] Re: please support :target
Doesn't this work? $('#' + location.target).css('background', 'url(fade-yellow.gif)').css('font-weight', 'bold'); On Tue, Feb 24, 2009 at 9:42 AM, dccrowley wrote: > > http://www.w3.org/TR/css3-selectors/#target-pseudo > > :target makes it very easy to style a part of a page that has been > scrolled to. It is not supported by all browsers but the css rules are > easy to write. I wish something similar would be possible in jquery. > > :target { background: url(fade-yellow.gif) font-weight: bold; } > > MAybe it is possible. I can't find it though. >
[jQuery] Re: Validation Plugin: Too Much Recursion
James, We just ran into the same issue. In my case we are opening a modal window with nyroModal. Here is the validate function. var myValidate = $("#myform").validate({ ignoreTitle: true, focusCleanup: false, ignoreTitle: true, debug: true, onfocusout: false, submitHandler: function(form) { // do other stuff for a valid form $(form).submit(); parent.$.nyroModalRemove(); return false; }, rules: { with_req_request_date: { required: true, date:true }, with_req_request_type: { required: true }, withdrawal_reason_id: { required: true }, case_note: { required: true } }, messages: { with_req_request_date: "Please enter the date in proper 'mm/dd/' format", with_req_request_type: "Please select the request type", withdrawal_reason_id: "Please select the withdrawal reason", case_note: "Please enter the case note" } // } ) }) //End of validate What I did notice if that I do not do the form.submit inside the submit handler the recursion does not occur. Not sure if that helps. Also in this case this is the only validate call. Kevin On Feb 9, 1:19 am, James wrote: > Since you can't show any code, with only what I see there should not > be any issues... > That is, there is no issue with using twovalidatefunctions on two > different forms, each with it's own set of rules. > > You're going to have to show more code for us to get to down to the > issue. > > On Feb 8, 5:54 pm, Cutter wrote: > > > I have an odd thing happening with the Validation Plugin (latest build > > on JQuery 1.3). I have several forms setup on a page, with validation > > on two. My first works fine, but my second keeps giving me errors in > > Firebug about 'too muchrecursion'. The configs for these two form > > validations are nearly identical, with the exception of the rules and > > messages, which are very basic field-is-requirewswwd kinda stuff. Some > > searching on the web shows me that there used to be a ticket on this > > (#2995), but that it was closed without fix. > > > I have stripped down my second form'svalidatemethod (the one that is > > erroring) to the barest of validation scripts, and can not get by it > > for the life of me. The configs each set avalidate() method on a > > separate form. > > > $('#frm1').validate({ > > // config here > > > } > > > $('#frm2').validate({ > > // second config here > > > } > > > I am getting nowhere. Anyone? > > > (BTW, I can't post the code, or show you a form, because it's all > > behind the firewall)
[jQuery] Re: Json help adding into Object
> I would like to use Objects better, because I would like to use the > little search code. When I try and run the program the error message I > get from FF is 'Error: abbrs[somevar] is undefined'. > The full script: > > $("#load_abbr_data").click(function() > { > var abbrs = {} > > $.getJSON("jsondata.php",function(data) > { > > $.each(data.abbr_data, function(i,get_abbr_data) > { > var abbr = get_abbr_data.ABBR; > var desc = get_abbr_data.DESCRIPTION; > var lang = get_abbr_data.LANG; > > abbrs = > { > abbr : [desc], > } > > }); > > }); > > var somevar = "PHP"; > for( var i = 0 ; i < abbrs[somevar].length; i++) > { > var expanded = abbrs[somevar]; > > } > document.write( somevar + " is short for " + expanded ); > > }); > > Yeah, you're kind of all over the place with that code. Try this (note the comments): $("#load_abbr_data").click(function() { var abbrs = {}; // hash $.getJSON("jsondata.php",function(data) { $.each(data.abbr_data, function(i,get_abbr_data) { var abbr = get_abbr_data.ABBR; var desc = get_abbr_data.DESCRIPTION; var lang = get_abbr_data.LANG; // add to hash abbrs[abbr] = desc; }); // still inside getJSON callback, dump output // by iterating all properties of abbrs hash for (var a in abbrs) { // 'a' is the current property we're iterating document.write(a + " is short for " + abbrs[a]); } }); });
[jQuery] easy way to include clueTip content in form
Hello everyone, I am using a clueTip to show a couple of options (checkboxes) on a form. It took me quite awhile to realize that the cluetip checkboxes are a copy of the original group of checkboxes, existing outside of the form. Therefore, the checkboxes were not submitted in their state. So, the problem is: What is the correct way to write back the values of the cluetip checkboxes to the original ones upon closing the cluetip? I think I could write a function which on close iterates over the copy and writes back the values, but isnt there an easier way? I would be very grateful for a few pointers on this.