[jQuery] Re: events, lock and unlock
Hi Cequiel, I've some questions to your problem. 1. Who triggers your events and when are they (supposed) to be dispatched? 2. If anotherevent happens before myevent it will have no effect on anotherobject. So what is anotherevent for? 3. What do you mean with lock/unlockEvent()? by(e) Stephan 2009/2/3 Cequiel gonzalo.chumil...@gmail.com: Hi everybody, I have the next silly problem: $(myobject).bind('myevent', function() { var anotherobject = new MyCustomObject(); $(anotherobject).bind('anotherevent', function() { // code here }); }); and then I write these two lines: $(myobject).trigger('myevent'); $(myobject).trigger('myevent'); The problem is that sometimes 'myevent' is dispatched before the 'anotherevent' and I would like to be sure that the 'anotherevent' has been dispached previously. I'm thinking in something like this: $(myobject).bind('myevent', function() { // here we lock 'myevent' $(myobject).lockEvent('myevent); var anotherobject = new MyCustomObject(); $(anotherobject).bind('anotherevent', function() { // code here // here we unlock 'myevent' so we are sure 'myevent' is dispached after the 'anotherevent' $(myobject).unlockEvent('myevent'); }); }); I now it is a strange question :) and I currently I'm doing it in another way, but I'm curios about it. Thank you in advance and sorry for my English.
[jQuery] Re: Hide or show div depending on the value of radio button
It's fairly simple to do. I haven't tested this piece of code, but it should work. $(div[id^=PrimaryBox] :radio).click(function() { var clicked_val = $(this).val(); var div_idstr = $(this).parent('div').attr('id') var group_number = div_idstr.substring (div_idstr.length-1,div_idstr.length) alert(clicked_val) if(clicked_val == '3') { $(#SecondaryBox+group_numer).show() } else { $(#SecondaryBox+group_numer).hide() } }); On Feb 3, 3:53 am, James james.gp@gmail.com wrote: I have no idea if this works or is a good way to do it, but hopefully gives you an idea $(function() { $(div[id^=SecondaryBox]).hide(); // hides all secondary boxes $(input[name^=MainStuff]).bind(click, function() { var selected = $(:checked, this).val(); // get value of checked radio button var nextDiv = $(this).parent().parent().next(); // gets the secondaryBox relative to clicked radio button if (selected == '3') nextDiv.show(); else nextDiv.hide(); }); }); On Feb 2, 3:04 pm, StanW webe...@u.washington.edu wrote: I am trying to understand show/hide toggled from the value of a selected radio button. I know this topic has been addressed here often, but I cannot seem to apply other's answers. I have a series of primary radio button groups. Each primary group has a single associated secondary group. I want the secondary group to be hidden on load, but then toggled if a specific primary radio button is chosen. For example in the code below, I would like the secondary radio groups to only appear if the value 3 is selected. Once the group is shown, if another value is selected I would like like the secondary radio group to be re-hidden. If it makes easier code, the value 3 will always be the value to show any of the secondary groups. This must be doable, but is beyond me. Thank you for your help! HTML: pSecondaryBox1 should be hidden until PrimaryBox1 is selected as value 3, then toggled if PrimaryBox1 is something other than 3 /p div id=PrimaryBox1 fieldset input name=MainStuffQ1 type=radio value=1 / 1 input name=MainStuffQ1 type=radio value=2 / 2 input name=MainStuffQ1 type=radio value=3 / 3 /fieldset /div div id=SecondaryBox1 fieldset input name=SecondaryStuffQ1 type=radio value=a / a input name=SecondaryStuffQ1 type=radio value=b / b input name=SecondaryStuffQ1 type=radio value=c / c input name=SecondaryStuffQ1 type=radio value=d / d /fieldset /div pSecondaryBox2 should be hidden until PrimaryBox2 is selected as value 3, then toggled if PrimaryBox2 is something other than 3 /p div id=PrimaryBox2 fieldset input name=MainStuffQ2 type=radio value=1 / 1 input name=MainStuffQ2 type=radio value=2 / 2 input name=MainStuffQ2 type=radio value=3 / 3 /fieldset /div div id=SecondaryBox2 fieldset input name=SecondaryStuffQ2 type=radio value=a / a input name=SecondaryStuffQ2 type=radio value=b / b input name=SecondaryStuffQ2 type=radio value=c / c input name=SecondaryStuffQ2 type=radio value=d / d /fieldset /div -- View this message in context:http://www.nabble.com/Hide-or-show-div-depending-on-the-value-of-radi... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Why does it conflict?
I found the problem, since the banner include needs jquery, in a page where jquery is altready included (with script src) I have actually two instances of jquery, with only one it works perfectly. Now I just need to understand how can I check if jquery is already in a page! Thanks On Feb 2, 10:53 pm, James james.gp@gmail.com wrote: I can't see the issue either... I suggest just creating a simplified version of a form with Validator and the banner code and see what happens. Maybe the issue lies somewhere else. Otherwise, strip out code one-by-one in your banner code to see where the issue lies if you're sure it's in the banner code. On Feb 2, 6:43 am, david.0pl...@gmail.com david.0pl...@gmail.com wrote: Hello, I'm developing an open source banner server, and I encountered a strange behaviour. First of all the banner system uses jquery (apart from validation) to rotate the banners, using this code: var image_count; var current_image=0; $(document).ready(function(){ image_count = $(div.img-rotate).hide().size(); $(div.img-rotate:eq(+current_image+)).show(); setInterval(feature_rotate,5000); //time in milliseconds }); function feature_rotate() { old_image = current_image%image_count; new_image = ++current_image%image_count; $(div.img-rotate:eq( + new_image + )).fadeIn(slow, function() { $(div.img-rotate:eq( + old_image + )).fadeOut(slow); }); } Now, everything works nice, the problem arise when a include the banner in one of the admin pages (which has jquery validation) called simply like this: $(document).ready(function(){ $(#edit).validate(); }); The error is (firebug): $(#edit).validate is not a function The error stops (and the validation works) if I remove the image rotation code from above. I don't have enough knowledge to understand thisconflict, does anybody can help me? Thanks David p.s. validator =http://docs.jquery.com/Plugins/Validation
[jQuery] jquery validation on non java complaint browser
Since I started messing around with jquery, I'm astonished on how simple a java web form validation is.. the problem is when a person has a non java brower or disable it, then basically the java validation is useless! Now, since I use php I also have the standard server side validation but I was wondering if there are any shortcut that I'm not aware of, what is the best practice to handle a non java browser (like disabling the form on a non enabled broser?). Please enlighten me! Thanks David
[jQuery] Problem with Chrome firing events correctly
I am having trouble getting this piece of code to work correctly in Chrome. It works just fine in in IE7, IE8, and FF. Watching the Chrome javascript console doesn't reveal anything useful. I manually checked each value in the if statements, and they are all coming back true. The textbox is not created or changed using javascript so I shouldn't need to use .live. $('#textbox').bind('keyup focus blur', function() { if(LiveSaver.enabled === true ((new Date()).getTime() - LiveSaver.lastSave) LiveSaver.saveThreshold) { LiveSaver.lastSave = (new Date()).getTime(); if($('#' + element).val() != LiveSaver.data[LiveSaver.page][element]) { LiveSaver.add(element, $('#' + element).val()); LiveSaver.save(); } } }); -- Caleb
[jQuery] Re: Why does it conflict?
Mhhh still I would love to understand why this happens, this is the situation: update.php has before the head: script src=../js/jquery.js type=text/javascript/script script src=../js/jquery.validate.js type=text/javascript/ script The script works as normal, then it has a preview of the banner that outputs this html in the middle of the page (between the body tags and inside a div) script type=text/javascript src=http://localhost/banner/js/ jquery.js script type=text/javascript src=http://localhost/banner/js/ rotator.js Then it's normal output (several div a img) Anyway, both script works perfectly, except together (see the error on the first message)! If i remove the jquery on the including page (the one inside the head tag) nothing changes, when I remove the jquery on the included page (the one in the body tags) everything works! What is the meaning of this? Why does this happens? How can I avoid it? Thanks On Feb 3, 9:43 am, david.0pl...@gmail.com david.0pl...@gmail.com wrote: I found the problem, since the banner include needs jquery, in a page where jquery is altready included (with script src) I have actually two instances of jquery, with only one it works perfectly. Now I just need to understand how can I check if jquery is already in a page! Thanks On Feb 2, 10:53 pm, James james.gp@gmail.com wrote: I can't see the issue either... I suggest just creating a simplified version of a form with Validator and the banner code and see what happens. Maybe the issue lies somewhere else. Otherwise, strip out code one-by-one in your banner code to see where the issue lies if you're sure it's in the banner code. On Feb 2, 6:43 am, david.0pl...@gmail.com david.0pl...@gmail.com wrote: Hello, I'm developing an open source banner server, and I encountered a strange behaviour. First of all the banner system uses jquery (apart from validation) to rotate the banners, using this code: var image_count; var current_image=0; $(document).ready(function(){ image_count = $(div.img-rotate).hide().size(); $(div.img-rotate:eq(+current_image+)).show(); setInterval(feature_rotate,5000); //time in milliseconds }); function feature_rotate() { old_image = current_image%image_count; new_image = ++current_image%image_count; $(div.img-rotate:eq( + new_image + )).fadeIn(slow, function() { $(div.img-rotate:eq( + old_image + )).fadeOut(slow); }); } Now, everything works nice, the problem arise when a include the banner in one of the admin pages (which has jquery validation) called simply like this: $(document).ready(function(){ $(#edit).validate(); }); The error is (firebug): $(#edit).validate is not a function The error stops (and the validation works) if I remove the image rotation code from above. I don't have enough knowledge to understand thisconflict, does anybody can help me? Thanks David p.s. validator =http://docs.jquery.com/Plugins/Validation
[jQuery] [Superfish] Submenus appear underneath menu items when the menu wraps
Hi, As per this example: http://dev2.savingforchildren.co.uk/mjs/menu.epl I find that if my menus wrap in IE, then the submenus appear underneath the other menus. In Firefox it's fine. Is there a way round this or is wrapping menus not supported? Thanks Michael
[jQuery] Re: [Superfish] Submenus appear underneath menu items when the menu wraps
Try setting z-index value in CSS for the current menu list with a higher value like 1000. Read my jQuery HowTo Blog- http://jquery-howto.blogspot.com On Tue, Feb 3, 2009 at 2:42 PM, Michael Smith smi...@gmail.com wrote: Hi, As per this example: http://dev2.savingforchildren.co.uk/mjs/menu.epl I find that if my menus wrap in IE, then the submenus appear underneath the other menus. In Firefox it's fine. Is there a way round this or is wrapping menus not supported? Thanks Michael
[jQuery] Re: Problem with Chrome firing events correctly
Hi Caleb, Could you please post your LiveSaver object and the element variable initialization as well. I tested your code with a more or less meaningful dummy implementation of LiveSaver and element and it works for me in: FF3, Chrome1, Opera9, IE8 I guess the problem is either in LiveSaver.add() or LiveSaver.save(). by(e) Stephan 2009/2/3 Caleb Morse morse.ca...@gmail.com: I am having trouble getting this piece of code to work correctly in Chrome. It works just fine in in IE7, IE8, and FF. Watching the Chrome javascript console doesn't reveal anything useful. I manually checked each value in the if statements, and they are all coming back true. The textbox is not created or changed using javascript so I shouldn't need to use .live. $('#textbox').bind('keyup focus blur', function() { if(LiveSaver.enabled === true ((new Date()).getTime() - LiveSaver.lastSave) LiveSaver.saveThreshold) { LiveSaver.lastSave = (new Date()).getTime(); if($('#' + element).val() != LiveSaver.data[LiveSaver.page][element]) { LiveSaver.add(element, $('#' + element).val()); LiveSaver.save(); } } }); -- Caleb
[jQuery] Re: How do I write a function to close shadowbox?
Where you call the shadowbox element? instead of doing shadowbox.whatever(), try var myShad=shadowbox.whatever() , then myShad.close() should do the trick. On 10 Dic 2008, 22:10, Rick Faircloth r...@whitestonemedia.com wrote: For my success callback (I guess that's what you call it...) I've got a series of events after an $.ajax post. Here they are: $('#contentdiv').empty().fadeIn(1000).append(response.login); $('#my_story').empty().fadeIn(2000).append(response.my_story); $('#email').empty().fadeIn(2000).append(response.email_address); $('#pass').empty().fadeIn(2000).append(response.password); These evens happen inside ashadowboxmodal window. After the last one, I want to auto-close theshadowbox. Theshadowboxcommand for doing that is .close() . What I can't figure out is how to referenceshadowboxitself like I do elements with an id or class, etc. Anyone got a pointer for this? Thanks, Rick
[jQuery] Re: access table row[y] cell[x]
I agree. The overloading does make the methods inscrutable (at least for a beginner). JAS On Feb 3, 5:50 am, RobG rg...@iinet.net.au wrote: On Feb 3, 7:25 am, Michael Geary m...@mg.to wrote: That didn't work because .html is a method, not a property you can set. Not exactly - the issue is that the OP is assigning a value to the jQuery.html property instead of calling the function referenced by it and passing the value as an argument. This is one of the gottchas of overloading of methods - instead of getHTML() and setHTML('...') methods which clearly indicate how they shoudl be used, the one method is used for both and the programmer has to work out what was intended from the context, not the method name. -- Rob
[jQuery] Re: access table row[y] cell[x]
I'll give your idea a try. I am learning jQuery (albeit slowly). Thanks for your help. JAS On Feb 2, 11:01 pm, Ricardo Tomasi ricardob...@gmail.com wrote: You can also write your own methods, that's the beauty of jQuery: jQuery.fn.getCell = function(x,y){ return jQuery( this[0].rows[y].cells[x] ); }; $('#myTable').getCell(5,1).html('New content'); - ricardo On Feb 2, 7:25 pm, Michael Geary m...@mg.to wrote: That didn't work because .html is a method, not a property you can set. This would have a better chance of working: $('#myTable tr:eq(4) td:eq(3)').html( 'new text' ); But what was wrong with your original code? It looked fine to me (except for the var oCell = part - that doesn't look right, since it sounds like you're expecting oCell to be a reference to the column element when it will actually be the text string). And I suspect that the integer row and column numbers will probably not be hard coded numbers in the actual code, but variables, right? So your actual jQuery code might be something more like: $( '#myTable tr:eq(' + y + ') td:eq(' + x + ')' ).html( text ); Instead of all that, you could use jQuery just as a shortcut for the document.getElementById() call and keep the rest of your code. And since you're probably doing a number of jQuery and DOM operations on the table, let's cache the table's jQuery object and DOM element in a pair of variables: var $myTable = $('#myTable'), myTable = $myTable[0]; // ...and later... myTable.rows[y].cells[x].innerHTML = text; This is both simpler and cleaner than the :eq() selector, and it's likely to be much faster too. -Mike From: JAS Well I tried: $(#myTable tr:eq(4) td:eq(3)).html = new text; and, while it gave no error, it also produced no result. Any other ideas? JAS On Feb 2, 5:15 pm, ksun kavi.sunda...@gmail.com wrote: try $(#myTable tr:eq(4) td:eq(1)).html() for the 5th row and 2nd column On Feb 2, 5:46 am, JAS james.sch...@gmail.com wrote: I am (very) new to jQuery, and I have what I think must be a simple question. Without jQuery, I would write: var oCell = document.getElementById('myTable').rows[5].cells [2].innerHTML = something new; but I do not understand how to write this same line in jQuery. Thanks to anyone who can help. JAS
[jQuery] Re: jquery validation on non java complaint browser
First of all, it's JavaScript, not Java. Second, you always need serverside validation - anything on the clientside can be disabled. An attacker wouldn't even have to use a browser to submit the form. In other words: Implement both. Serverside for security and data integrity, clientside for a better user experience. Jörn On Tue, Feb 3, 2009 at 9:47 AM, david.0pl...@gmail.com david.0pl...@gmail.com wrote: Since I started messing around with jquery, I'm astonished on how simple a java web form validation is.. the problem is when a person has a non java brower or disable it, then basically the java validation is useless! Now, since I use php I also have the standard server side validation but I was wondering if there are any shortcut that I'm not aware of, what is the best practice to handle a non java browser (like disabling the form on a non enabled broser?). Please enlighten me! Thanks David
[jQuery] Re: Need help validating a dropdown list
Ah, good catch. I forgot that the text is used as a value when no value-attribute is provided. Good to know you got it working! Jörn On Tue, Feb 3, 2009 at 3:10 AM, Kathryn kathry...@gmail.com wrote: Jörn, Many thanks for the clarification and tip. When I removed the value attribute completely, it didn't work, but when I left it in with no value, the error message came up as expected. The code below works. Thanks again-- Kathryn select name='class_date' id='class_date' class='required' option value=''--Select One--/option optionFeb 16 - 20, 2009/option optionMar 16 - 20, 2009/option optionApr 13 - 17, 2009/option optionMay 11 - 15, 2009/option /select On Feb 1, 4:54 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Dropdowns are supported just fine. Just remove the value attribute from the select one option and add a required rule for the field. See alsohttp://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo... Jörn On Sat, Jan 31, 2009 at 7:59 PM, Kathryn kathry...@gmail.com wrote: Hi all, I'm using the fantastic validation plugin (from bassistance.de) and have run into a little glitch. I understand the plugin doesn't currently handle dropdowns, but I found a possible solution on True Tribe (http://www.thetruetribe.com/jquery/1-jquery-api/68-jquery- plugin-validation-with-ajax). I can't get it to work, though. I'm pretty new to jQuery and am probably making an obvious error I can't see. Here's my jQuery code: $(document).ready(function(){ $(#reg_form).validate({ onfocusout: false, onkeyup: false, onclick: false, rules: { gender: {required:true}, spouse_attend: {required:true} } }); $validator.addMethod( select_class, function(value, element) { return this.optional(element) || ( value.indexOf(--Select One--) == -1); }, Please select a class.); }); And here's the dropdown I'm trying to validate. select name='class_date' id='class_date' class='select_class' option value='--Select One--'--Select One--/option optionFeb 16 - 20, 2009/option optionMar 16 - 20, 2009/option optionApr 13 - 17, 2009/option optionMay 11 - 15, 2009/option /select What am I doing wrong? Or is there another way to do this? Thanks in advance! Kathryn
[jQuery] Re: [Superfish] Submenus appear underneath menu items when the menu wraps
Thanks jQuery Lover - I messed around with a few things without success. Any chance you can be more specific as to the css change needed? Thanks again Michael On Tue, Feb 3, 2009 at 9:48 AM, jQuery Lover ilovejqu...@gmail.com wrote: Try setting z-index value in CSS for the current menu list with a higher value like 1000. Read my jQuery HowTo Blog- http://jquery-howto.blogspot.com On Tue, Feb 3, 2009 at 2:42 PM, Michael Smith smi...@gmail.com wrote: Hi, As per this example: http://dev2.savingforchildren.co.uk/mjs/menu.epl I find that if my menus wrap in IE, then the submenus appear underneath the other menus. In Firefox it's fine. Is there a way round this or is wrapping menus not supported? Thanks Michael
[jQuery] Re: DOM manipoulation after ajax load
Ok, I'll be more specific to make your life easier :) The reason your code example doesn't work, is because you start the load request, but that is asynchronous (the first A in AJAX :)), and javascript will execute your next statement with 'each' before the .load is finished, it doesn't wait for the load to finish. In order to do that you need to add a callback function to the load, and add your events there: $('#menu).load('/menu', {}, function() { $('#level1 a').each(function(){$(this).click(function(){alert 'test'})}) }); On Feb 2, 5:06 pm, Mike McNally emmecin...@gmail.com wrote: The load() function allows a second parameter that's called after the load completes. On Mon, Feb 2, 2009 at 9:03 AM, Mauricio (Maujor) Samy Silva css.mau...@gmail.com wrote: Hi HK It doesn't works because elements loaded via AJAX isn't available when the page is just loaded. Before version 1.3.1 to bind events to elements loaded via AJAX you must use the LIVEQUERY plugin. Version (1.3) 1.3.1 added the live() and die() methods that should solve your problem. Have a look at:http://docs.jquery.com/Events/live#typefn Maurício -Mensagem Original- De: HK hkosm...@gmail.com Para: jQuery (English) jquery-en@googlegroups.com Enviada em: segunda-feira, 2 de fevereiro de 2009 09:21 Assunto: [jQuery] DOM manipoulation after ajax load Hello, I have the following case and I don't know what's happening... I have a sidebar #menu where in document ready I have: $('#menu).load('/menu') #menu is loaded with something like: div id=menu div id=level1 various a tags /div div id=level2 various a tags /div div id=level3 various a tags /div /div Now I want to assign to each of the a tags some click functions. I do : $(document).ready(function() { $('#menu).load('/menu'); $('#level1 a').each(function(){$(this).click(function(){alert 'test'})}) }) But this doesn't work. Can jquery access elements it has loaded with load ajax function? thanks -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] DOM element as message when blocking element
I seem to have found a bug. If I try to use $('#someelement').block ({ message: $('#loadingMessage') }); Then when I unblock with $('#someelement').unblock(); the loading message is removed from the DOM, so any subsequent calls to block it fail and cause a JS error. Everything works fine if I block the whole page with $.blockUI({ message: $('#loadingMessage') }); then $.unblockUI(); but I don't want to block the whole UI. Is this a bug or am I doing something wrong?
[jQuery] autocomplete-comma delimeter string from servlet
Hi, all. i just started to use Jquery. i m using remote data to pass into jQuery widget, autocomplete. but the data from the servlet is generated in this format a, b,c, how can i break the data from the servlet to populate the autocomplete ? Please advice.i m using java for the servlet and the jsp page to for the form.
[jQuery] jQuery (English)
http://www.freewebs.com/massmodern/ http://www.runautowithwater.com http://seniorfriendfinder.com http://www.adbrite.com/mb
[jQuery] Jquery cycle plugin - YouTube videos
Hi, Im trying to create a rotating promo area using the cycle plug-in. I have to to embed YouTube videos (example here http://www.grouptools.com/adrian/sbc-new/promo/) The main issue is FF works fine in that if a video is playing and you go to another 'slide' the video/sound stops. Where as IE7 continues to play the video and sound behind the scenes even when looking at other 'slides' Does anyone have any ideas how to fix this? Adi
[jQuery] DIV position
Is there any way to set the z-index of the div? I have series of hidden DIVs (in each row of table and clicking any of those would pop-up a information guide) Here is my code: function showProfile(id) { $('#profile_' + id).show(slow, hideAllProfile (id)); } function hideAllProfile(id) { $(.profilePopup:not(#profile_ + id + )).hide(); } This works fine for me on IE browsers. However putting my DIV behind the table cell on other browsers. Even setting z-index for the DIV is not working in this case. Please help! Thanks, Paresh
[jQuery] Re: jquery validation on non java complaint browser
I was just using java as a nickname for javascript Anyway thank you, it's what I suspected, at least now I'm sure! Thanks On Feb 3, 11:57 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: First of all, it's JavaScript, not Java. Second, you always need serverside validation - anything on the clientside can be disabled. An attacker wouldn't even have to use a browser to submit the form. In other words: Implement both. Serverside for security and data integrity, clientside for a better user experience. Jörn On Tue, Feb 3, 2009 at 9:47 AM, david.0pl...@gmail.com david.0pl...@gmail.com wrote: Since I started messing around with jquery, I'm astonished on how simple a java web form validation is.. the problem is when a person has a non java brower or disable it, then basically the java validation is useless! Now, since I use php I also have the standard server side validation but I was wondering if there are any shortcut that I'm not aware of, what is the best practice to handle a non java browser (like disabling the form on a non enabled broser?). Please enlighten me! Thanks David
[jQuery] Accordion menue with up to 3 levels
Hi, I am wanting to use the jquery accordion menu with a structure up to 3 levels. Is that a) possible and b) has somebody a demo / tutorial for this kind of menu for me? Thanks! Heidi
[jQuery] Div's conflicting with each other
Hello all, I am using the jqGalScroll v2.1 Photo Gallery on my site. I have implemented the version that koesbong made at http://www.ryanbrenizer.com/wedding_portrait, but I am having an issue with Internet Explorer that I was hoping you can help me with. This is the Image Gallery in it's correct position, but it's making the buttons on the left not rollover or be clickable through the different sections anymore: http://idea-palette.com/testfolder/pagetest3e5.html This is the Image Gallery where I added a bunch of break tags before the Image Gallery in the html and it works then. I think the buttons are being affected as soon as anything is put on the right side of it: http://idea-palette.com/testfolder/pagetest3e5b.html This is another example in which I made a paragraph tag with some text and then gave that paragraph an absolute position. This works and lets me keep everything in the correct position: http://idea-palette.com/testfolder/pagetest3e5c.html What I would like to do is add an absolute position either to the ul.jqGalScroll or to the div.jqGSContainer which is in the attached jqGalScroll.css. I already tried adding the absolute position to the ul but that didn't work. I can't figure out how to give the container that is created an absolute position. I hope you can help figure this out. -Chris -- View this message in context: http://www.nabble.com/Div%27s-conflicting-with-each-other-tp21810599s27240p21810599.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: DIV position
Div's require a position attribute before they will obey a z-index rule. Make sure your div has position:relative; or position:absolute; or position:fixed; On Feb 3, 6:22 am, Paresh pareshva...@gmail.com wrote: Is there any way to set the z-index of the div? I have series of hidden DIVs (in each row of table and clicking any of those would pop-up a information guide) Here is my code: function showProfile(id) { $('#profile_' + id).show(slow, hideAllProfile (id)); } function hideAllProfile(id) { $(.profilePopup:not(#profile_ + id + )).hide(); } This works fine for me on IE browsers. However putting my DIV behind the table cell on other browsers. Even setting z-index for the DIV is not working in this case. Please help! Thanks, Paresh
[jQuery] Performance suggestion: Use object hash instead of regexp
(This is really directed at the jQuery core team) I notice that jQuery uses regexp statements like this one... (used in the position() and offsetParent() methods for example) .../^body|html$/i.test(offsetParent.tagName) Might it be faster to use a simple object hash like this instead...? var test = {BODY:true, HTML:true}; ...test[offsetParent.tagName]; I did some crude experiments and found that the hash technique was at least 4 times faster in IE7 and 15 times faster in FF3. I've dumped some more info on http://blog.softwareunity.com/ I'm interested to hear people's opinions on this as a performance booster. (What shall I call it? Sizzle perhaps? No maybe that one's taken...)
[jQuery] Re: autocomplete-comma delimeter string from servlet
Hi, Eric. Thanks for the response. but i somehow kinda bump into the another way of getting it done. trial and error . :-) Its done using formatline option in autocomplete. I will paste the code here very soon. On Feb 3, 10:14 pm, Eric Garside gars...@gmail.com wrote: I'm not sure what kind of data autocomplete accepts, as I'm not familiar with the plugin, but I assume an array of values will work. If your Java servlet is returning a, b, c, d as your value string, call: var servletResponse = a, b, c, d; // Or however you get the value servletResponse = servletResponse.split(', '); // Split on the delimiter plus a space alert(servletResponse); // [a, b, c, d]; On Feb 3, 5:13 am, thomas.confuse choejens...@gmail.com wrote: Hi, all. i just started to use Jquery. i m using remote data to pass into jQuery widget, autocomplete. but the data from the servlet is generated in this format a, b,c, how can i break the data from the servlet to populate the autocomplete ? Please advice.i m using java for the servlet and the jsp page to for the form.
[jQuery] Re: Accordion menue with up to 3 levels
On 3 Lut, 14:32, heohni heidi.anselstet...@consultingteam.de wrote: I am wanting to use the jquery accordion menu with a structure up to 3 levels. Is that a) possible and b) has somebody a demo / tutorial for this kind of menu for me? try this http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/ -- regards, www.plusz.pl
[jQuery] Re: UI Tabs - change onClick behaviour
On 3 Lut, 15:17, Eric Garside gars...@gmail.com wrote: Try: $('#menu_zakladka3').unbind('click').click(function(){ window.location = 'http://some.url'; return false; }); hmm.. doesn't work but thank you very much :) I had to define behaviuor for 'a' inside #menu_zakladka3 and I unbinded all events $('#menu_zakladka3 a').unbind().click(function(){ window.location = 'http://some.url'; return false; }); THANK YOU for inspiration :) -- plusz.pl
[jQuery] Accordion menue with up to 3 levels
Hmm, thanks, but in my case I need it for a vertical column. Any other ideas maybe? -Ursprüngliche Nachricht- Von: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] Im Auftrag von plusz Gesendet: Dienstag, 3. Februar 2009 15:35 An: jQuery (English) Betreff: [jQuery] Re: Accordion menue with up to 3 levels On 3 Lut, 14:32, heohni heidi.anselstet...@consultingteam.de wrote: I am wanting to use the jquery accordion menu with a structure up to 3 levels. Is that a) possible and b) has somebody a demo / tutorial for this kind of menu for me? try this http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_m enu_2/ -- regards, www.plusz.pl
[jQuery] Need solution for select element value change...
Hi, all... Here's the code: $(document).ready(function() { $('.agents').change(function() { $('option:selected', this).each(function() { Here's the problem: I would like for the function triggered in the code above by .change to work if the same value is chosen in the select element .agents. Right now, the function following .change is only triggered if another value is selected. I tried .select, but that didn't work. I tried .click, too, but that wasn't satisfactory. Anyone have another option? Thanks, Rick
[jQuery] Re: toggle checkbox when clicking td
Well, that is very strange. It works with jQuery 1.2.6, but not with 1.3.1. Hmm. Will have to investigate. Most likely the problem is that .trigger()ed clicks bubble in 1.3 but they didn't in 1.2, and it's bubbling back up to the tr.
[jQuery] Re: Hide or show div depending on the value of radio button
typo: group_numer = group_number On Feb 3, 10:31 am, Beres Botond boton...@gmail.com wrote: It's fairly simple to do. I haven't tested this piece of code, but it should work. $(div[id^=PrimaryBox] :radio).click(function() { var clicked_val = $(this).val(); var div_idstr = $(this).parent('div').attr('id') var group_number = div_idstr.substring (div_idstr.length-1,div_idstr.length) alert(clicked_val) if(clicked_val == '3') { $(#SecondaryBox+group_numer).show() } else { $(#SecondaryBox+group_numer).hide() } }); On Feb 3, 3:53 am, James james.gp@gmail.com wrote: I have no idea if this works or is a good way to do it, but hopefully gives you an idea $(function() { $(div[id^=SecondaryBox]).hide(); // hides all secondary boxes $(input[name^=MainStuff]).bind(click, function() { var selected = $(:checked, this).val(); // get value of checked radio button var nextDiv = $(this).parent().parent().next(); // gets the secondaryBox relative to clicked radio button if (selected == '3') nextDiv.show(); else nextDiv.hide(); }); }); On Feb 2, 3:04 pm, StanW webe...@u.washington.edu wrote: I am trying to understand show/hide toggled from the value of a selected radio button. I know this topic has been addressed here often, but I cannot seem to apply other's answers. I have a series of primary radio button groups. Each primary group has a single associated secondary group. I want the secondary group to be hidden on load, but then toggled if a specific primary radio button is chosen. For example in the code below, I would like the secondary radio groups to only appear if the value 3 is selected. Once the group is shown, if another value is selected I would like like the secondary radio group to be re-hidden. If it makes easier code, the value 3 will always be the value to show any of the secondary groups. This must be doable, but is beyond me. Thank you for your help! HTML: pSecondaryBox1 should be hidden until PrimaryBox1 is selected as value 3, then toggled if PrimaryBox1 is something other than 3 /p div id=PrimaryBox1 fieldset input name=MainStuffQ1 type=radio value=1 / 1 input name=MainStuffQ1 type=radio value=2 / 2 input name=MainStuffQ1 type=radio value=3 / 3 /fieldset /div div id=SecondaryBox1 fieldset input name=SecondaryStuffQ1 type=radio value=a / a input name=SecondaryStuffQ1 type=radio value=b / b input name=SecondaryStuffQ1 type=radio value=c / c input name=SecondaryStuffQ1 type=radio value=d / d /fieldset /div pSecondaryBox2 should be hidden until PrimaryBox2 is selected as value 3, then toggled if PrimaryBox2 is something other than 3 /p div id=PrimaryBox2 fieldset input name=MainStuffQ2 type=radio value=1 / 1 input name=MainStuffQ2 type=radio value=2 / 2 input name=MainStuffQ2 type=radio value=3 / 3 /fieldset /div div id=SecondaryBox2 fieldset input name=SecondaryStuffQ2 type=radio value=a / a input name=SecondaryStuffQ2 type=radio value=b / b input name=SecondaryStuffQ2 type=radio value=c / c input name=SecondaryStuffQ2 type=radio value=d / d /fieldset /div -- View this message in context:http://www.nabble.com/Hide-or-show-div-depending-on-the-value-of-radi... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: UI Tabs - change onClick behaviour
Ah, yep, that'd do it. I'm terrible at reading HTML snippets early in the AM. Glad you got it fixed! :D On Feb 3, 9:45 am, plusz pluszpica...@googlemail.com wrote: On 3 Lut, 15:17, Eric Garside gars...@gmail.com wrote: Try: $('#menu_zakladka3').unbind('click').click(function(){ window.location = 'http://some.url'; return false; }); hmm.. doesn't work but thank you very much :) I had to define behaviuor for 'a' inside #menu_zakladka3 and I unbinded all events $('#menu_zakladka3 a').unbind().click(function(){ window.location = 'http://some.url'; return false; }); THANK YOU for inspiration :) -- plusz.pl
[jQuery] Re: How to enlarge size proportionally
Hmm. Lets say you need it to grow 100px. Would: $('#anim').animate({paddingLeft: 50, width: 50}); work? It's hard to say what would help without a better idea of what the element you want to grow looks like. On Feb 3, 9:34 am, David .Wu chan1...@gmail.com wrote: animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: Performance suggestion: Use object hash instead of regexp
The problem I can forsee getting into is the sheer lack of power in a hash. It's stock and faster for a reason: everything is predefined and a simple check. Try your method vs. jQuery's on the following selector: #somelem.ui-state-active.container .list li a span.enabled That should match only: div id=somelem class=ui-state-active container ul class=list lia href=#span class=enabledTest/span/a/li /ul /div Using a hash I can see for some situations, but unless you can figure out a way (and I'd be super interested if you could) to do complex cascade parsing without regex, your method seems like double the work of rewriting with no benefits towards maintainability and a minor speed increase for only certain tags. Just my $.02 On Feb 3, 9:32 am, George Adamson george.adam...@softwareunity.com wrote: (This is really directed at the jQuery core team) I notice that jQuery uses regexp statements like this one... (used in the position() and offsetParent() methods for example) .../^body|html$/i.test(offsetParent.tagName) Might it be faster to use a simple object hash like this instead...? var test = {BODY:true, HTML:true}; ...test[offsetParent.tagName]; I did some crude experiments and found that the hash technique was at least 4 times faster in IE7 and 15 times faster in FF3. I've dumped some more info onhttp://blog.softwareunity.com/ I'm interested to hear people's opinions on this as a performance booster. (What shall I call it? Sizzle perhaps? No maybe that one's taken...)
[jQuery] Re: find text within the page
Rob, My problem is that I have no way of knowing where the keyword may appear. It might be tabular data (TD) or in descriptive paragraph (p). So if my keyword is RED, then... BEFORE p the red fox /p AFTER pthe spanred/span fox/p I'll have an array of keywords as well. var arrayx[one, two three] On Feb 2, 5:57 pm, RobG rg...@iinet.net.au wrote: On Feb 3, 8:01 am, paulinstl paulsha...@gmail.com wrote: I'm looking for a way to locate keywords to help the end user out. For instance, if I want to find the word polar then i'd like my function to locate it, wrap it with a span, and assign it a function. so far I can locate using a content filter and classname like this... $(.keyword:contains('polar')) But this selects the whole element (paragraph, div, whatever) how do i focus in on JUST the text? The most reliable method is to traverse the part of the DOM you want to search and look at the value of text nodes. If you want to highlight a particular character pattern, use a regular expression and DOM methods to wrap it in a suitable element, say a span. It would also be prudent to also put adjacent text in spans too, e.g. divLorem ipsum dolor sit amet, consectetur adipiscing elit./dv might become: divspanLorem ipsum /spanspan class=foodolor/span span sit amet, consectetur adipiscing elit./span/dv That way you can also deal with text found inside elements like B or QUOTE if necessary. Other approaches such as using a regular exprssion and an element's innerHTML property, are likely to be error prone. -- Rob
[jQuery] Re: find text within the page
Try: $(function(){ var keywords = [ ... ]; $.each(keywords, function(){ var kw = this, rx = new RegExp('/^ '+kw+' $/'); $(.keyword:contains('+kw+')) .each(function(){ $(this).text($(this).text().replace(rx, 'span'+kw+'/ span')); }); }); }); It's untested, but I think that should work? The Regex is adding whitespace to either side of the keyword intentionally, to only catch full words (so the RED fox gets matched but was near a REDwood tree. does not. Though, I'm not a regexpert, so I'm not positive what I've given you is the right way to go there, but hopefully it gives you a base to work from. On Feb 3, 10:20 am, paulinstl paulsha...@gmail.com wrote: Rob, My problem is that I have no way of knowing where the keyword may appear. It might be tabular data (TD) or in descriptive paragraph (p). So if my keyword is RED, then... BEFORE p the red fox /p AFTER pthe spanred/span fox/p I'll have an array of keywords as well. var arrayx[one, two three] On Feb 2, 5:57 pm, RobG rg...@iinet.net.au wrote: On Feb 3, 8:01 am, paulinstl paulsha...@gmail.com wrote: I'm looking for a way to locate keywords to help the end user out. For instance, if I want to find the word polar then i'd like my function to locate it, wrap it with a span, and assign it a function. so far I can locate using a content filter and classname like this... $(.keyword:contains('polar')) But this selects the whole element (paragraph, div, whatever) how do i focus in on JUST the text? The most reliable method is to traverse the part of the DOM you want to search and look at the value of text nodes. If you want to highlight a particular character pattern, use a regular expression and DOM methods to wrap it in a suitable element, say a span. It would also be prudent to also put adjacent text in spans too, e.g. divLorem ipsum dolor sit amet, consectetur adipiscing elit./dv might become: divspanLorem ipsum /spanspan class=foodolor/span span sit amet, consectetur adipiscing elit./span/dv That way you can also deal with text found inside elements like B or QUOTE if necessary. Other approaches such as using a regular exprssion and an element's innerHTML property, are likely to be error prone. -- Rob
[jQuery] Simple selector not working in 1.3.1 and webkit (safari and chrome)
I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6
[jQuery] Re: Simple selector not working in 1.3.1 and webkit (safari and chrome)
Try this: var containerSelecteds = function() { return $('ul.selected', container); }; I've had pretty good luck using that syntax instead of using .find() or .children(). It might solve the problem on safari (as I think the reason I stopped using find() or children() was that the above was much more reliable on my mac for doing dev work.) On Feb 3, 10:39 am, Javier Martinez ecentin...@gmail.com wrote: I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6
[jQuery] Re: clueTip - can you parse out heading when reading from external file?
Thanks, ragx. I'm not having any problem with reading the text in from and internal, just with parsing out the header as I can do when the text is contained in the title attribute of the a tag and not an external file. On Feb 2, 11:21 pm, Mohd.Tareq tareq.m...@gmail.com wrote: may be this [rel=/text.htm] file not able to load or remove slash from rel tag rel = text.htm. if it will not sort with this way then write all the content into ur current html file [text.htm] try for this syntax rel=#id_of_text.html_content give a try. regards, ragx On Tue, Feb 3, 2009 at 9:29 AM, EricFettman eric.fett...@saiglobal.comwrote: Hi, folks -- Using the clueTip plugin, it's clear how to display a heading in your popup help window when the text is contained within the title attribute of the a tag selected: $('#popup1').cluetip({ splitTitle: '|', showTitle: true }); a id=popup1 class=noHilite title=Heading in the Popup Window| This is the body. This is the body. This is the body. Any way to do this when the text comes from an external file, as below? a id=popup2 href=/text.htm rel=/text.htm I can get the text to display in the body of the popup by applying cluetip() with no arguments to popup2, but if I use the same parameters as above, no text is displayed at all. Any help is appreciated - TIA. Eric -- ---| Regard |--- Mohd.Tareque- Hide quoted text - - Show quoted text -
[jQuery] Google maps
Hi, Hi have develop a google maps with a form at the top of a marker, but i want to register information by using ajax - $post(...) -. I've tried to manipulate the textboxes, but, with no success. code var infoTabs = [ new GInfoWindowTab(Dados, 'form id= method=post action=index.php?st=guardar' + ' divEmpresa/div' + ' divinput type=text id=txtempresa size=50 //div' + ' divMorada/div' + ' divinput type=text id=txtmorada size=50 //div' + ' divCód. Postal - Localidade/div' + ' divinput type=text id=txtcp size=10 / input type=text id=txtlocal size=30 //div' + ' divTelefone/div' + ' divinput type=text id=txttelf size=12 //div' + ' divFax/div' + ' divinput type=text id=txtfax size= //div' + ' divEmail/div' + ' divinput type=text id=txtemail size=40 //div' + ' div' + ' table' + ' tr' + ' tdLatitude/tdtdLongitude/td' + ' /tr' + ' tr' + ' tdinput type=text id=txtlat size=12 value=' + place.Point.coordinates[1] + ' //tdtdinput type=text id=txtlon size=12 value=' + place.Point.coordinates[0] + ' // td' + ' /tr' + ' /table/div ' + ' divinput type=submit id=btnguardar value=Guardar / /div' + '/form' ), new GInfoWindowTab(Informação, 'bAddress:/b' + place.address + 'br') ]; map.addOverlay(marker); marker.openInfoWindowTabsHtml(infoTabs); /code this is the code that shows de form when i click at the map. can any one give a clue to manipulate that objects, to save the information using $post ? thnks
[jQuery] Re: Simple selector not working in 1.3.1 and webkit (safari and chrome)
Thanks for the fast response. Unfortunately it doesn't work :( 2009/2/3 Eric Garside gars...@gmail.com Try this: var containerSelecteds = function() { return $('ul.selected', container); }; I've had pretty good luck using that syntax instead of using .find() or .children(). It might solve the problem on safari (as I think the reason I stopped using find() or children() was that the above was much more reliable on my mac for doing dev work.) On Feb 3, 10:39 am, Javier Martinez ecentin...@gmail.com wrote: I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6
[jQuery] Ajax: not understanding 4th param of $.post( url, [data], [callback], [type] )
I have stared at the docs for a while and still don't understand the purpose of the option 4th parameter in the $.post() method. The wording and examples at http://docs.jquery.com/Ajax/jQuery.post seem odd. E.g: [quote] Gets the test.php page contents which has been returned in json format (?php echo json_encode(array(name=John,time=2pm)); ?) $.post(test.php, { func: getNameAndTime }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, json); [/quote] We submit a POST request to test.php with parameter func = 'getNameAndTime' -- presumably for test.php's benefit so it can call that function, right? I think that's a little obscure in this example. Then we have an anonymous callback function that fires upon completion of a successful xhr request, its input parameter being 'data' which is the response body of the xhr object, right? In this instance, 'data' is an object -- a hash, an associative array, what have you. So if that's what it is, then it is what it is, so to speak. Is it not? I would expect that internally, JQuery would detect the content-type header indicating JSON and eval the xhr response body automatically. The server side would (and should) be responsible for sending the proper content-type. Am I to understand that in this example test.php might as well send plain old text/html, and the type hint json instructs JQuery to eval it?
[jQuery] How to make Jquery work properly
I have only been recently introduced to using JQuery and I am having basic problems of making it work. I previously used Takashi's MudCorp's Image Gallery but it came into conflict with the simple JQuery slideshow gallery I am implementing. What I have in my wordpress post is this: div id=section1 class=pics img src=/wp-content/uploads/ccp_invitation_no3_uk.jpg / img src=wp-content/uploads/arnsdorfss09_f.jpg / img src=wp-content/uploads/ccp_invitation_no3_uk.jpg / /div a id=prev href=#prev/anbsp;nbsp;nbsp;a id=next href=#next/a I've called my header with JQuery 1.2.3 and the JQuery Cycle Plugin 2.34. This is also in my header: script type=text/javascript $('#section1').cycle({ fx: 'fade', speed: 'fast', timeout: 0, next: '#next', prev: '#prev' }); /script and the page: a href=http://www.culturesinbetween.net/NEWWEBSITE/ archives/260website/a The fade transition does not work. Please help.
[jQuery] Using jQuery with Wordpress
I am having problems using jquery with wordpress. I would like to use the simple gallery plugin but it will not fade in/out my images. Help?
[jQuery] Re: append can not with form submit for IE
Hi Ken.. It seems problem in your jQuery.. reason is that some kind of statements cant be understood by the ie.. Ken Phan wrote: hi all ! i usage jquery appent 2 radio group to form. It work when submit in FF but does't work in IE. My code function checklistPanel (type, id,url){ var memory = false; var str = new String(); var newId = id.substr(1)+'-new'; var newIdo = id+'-new'; var currId = id.substr(1)+'-curr'; var currIdo = id+'-curr'; var button = new String(); var width = new Number(); var rows = new Number(); var title = $(id).text(); $(id).click(function(){ if(memory == true) { return false; } else if(memory == currIdo) { $.blockUI({ message: $(currIdo)[0], css: { width: width+'px', marginLeft: '-'+(width/2)+'px' }, overlayCSS: { background: #333, opacity: 0.7 } }); return false; } else { $(#et-search-main).block({ overlayCSS: { opacity: 0.4, backgroundColor: #fff } }); memory = true; $.getJSON(url, function(data){ width = (data.width == null || data.width == 0) ? 300 : data.width; rows = (data.rows == null || data.rows == 0) ? 3 : data.rows; $.each(data.items, function(i,item) { if(type == select) { if(i == 0) str += 'tr'; if((i%rows) == 0) str += '/trtr'; str += ' \ td \ label for='+data.name+item.id+' \ input name='+data.name+'[] type=checkbox id='+data.name +item.id+' value='+item.id+' title='+item.title+' / \ '+item.title+' \ /label \ /td'; if((i+1) == data.total) str += '/tr'; } else if(type == radio) { if(i == 0) str += 'tr'; if((i%rows) == 0) str += '/trtr'; str += ' \ td \ label for='+data.name+item.id+' \ input name='+data.name+' type=radio id='+data.name +item.id+' value='+item.id+' title='+item.title+' / \ '+item.title+' \ /label \ /td'; if((i+1) == data.total) str += '/tr'; } }); if(type == select) { button = ' \ div class=et-checklist-checkall id=et-checkall title=div class=\'et-tooltip-wrapper\' \ div class=\'et-tooltip\'Check alll/div \ /div \ /div \ div class=et-checklist-uncheckall id=et-uncheckall title=div class=\'et-tooltip-wrapper\' \ div class=\'et-tooltip\'Uncheck all/div \ /div \ /div'; } $(id).parent(td).append(' \ div class=et-checklist-wrapper id='+currId+' style=width:'+width+'px \ div class=et-checklist-box clearfix \
[jQuery] Help creating a function
Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin
[jQuery] Re: Ajax: not understanding 4th param of $.post( url, [data], [callback], [type] )
at api.jquery.com there is a well documented version.. @api doc devel: would be nice if we can link to a specific api page... On 3 Feb., 16:55, Professor B vtbludg...@gmail.com wrote: I have stared at the docs for a while and still don't understand the purpose of the option 4th parameter in the $.post() method. The wording and examples athttp://docs.jquery.com/Ajax/jQuery.postseem odd. E.g: [quote] Gets the test.php page contents which has been returned in json format (?php echo json_encode(array(name=John,time=2pm)); ?) $.post(test.php, { func: getNameAndTime }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, json); [/quote] We submit a POST request to test.php with parameter func = 'getNameAndTime' -- presumably for test.php's benefit so it can call that function, right? I think that's a little obscure in this example. Then we have an anonymous callback function that fires upon completion of a successful xhr request, its input parameter being 'data' which is the response body of the xhr object, right? In this instance, 'data' is an object -- a hash, an associative array, what have you. So if that's what it is, then it is what it is, so to speak. Is it not? I would expect that internally, JQuery would detect the content-type header indicating JSON and eval the xhr response body automatically. The server side would (and should) be responsible for sending the proper content-type. Am I to understand that in this example test.php might as well send plain old text/html, and the type hint json instructs JQuery to eval it?
[jQuery] Cascade plugin - feature/improvement request (data optimization)
Mike et all: Now that I've worked through some of the basics, I would like to know how easy it would be to accommodate a JSON file in a bit of a more efficient structure using arrays rather than simple value pairs. IE.: You have designed around this structure: {'when':'selectedValue','value':'itemValue','text':'itemText'} Whereas after some testing, I've realized the data sizes would become rather huge rather quickly. I'm proposing a JSON structure such as: { Country1: [ { Region1: [ City1, City2, City3 ], Region2: [ City1, City2, City3 ] } ] } The idea would be for a separate JSON file for each country (now that we've got dynamic URLs working). (see related discussion: [url]http:// groups.google.com/group/jquery-en/browse_thread/thread/ 142c1e9e9119b198#[/url] Of course this simplified structure would require some parsing and reformatting AFTER loading the JSON file to fit the structure used for the .CASCADE plugin. My problem is, since I'm so new to all this, I have no idea where in the code to begin looking at how to take my imported JSON file, and then do the work on it to change it into your format. Could you offer some insight on this? Thanks, James
[jQuery] Re: How to enlarge size proportionally
Sorry for my bad explanation, I make a sample online http://chan.idv.tw/animate/enlarge.html On 2月3日, 下午11時11分, Eric Garside gars...@gmail.com wrote: Hmm. Lets say you need it to grow 100px. Would: $('#anim').animate({paddingLeft: 50, width: 50}); work? It's hard to say what would help without a better idea of what the element you want to grow looks like. On Feb 3, 9:34 am, David .Wu chan1...@gmail.com wrote: animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: autocomplete-comma delimeter string from servlet
I'm not sure what kind of data autocomplete accepts, as I'm not familiar with the plugin, but I assume an array of values will work. If your Java servlet is returning a, b, c, d as your value string, call: var servletResponse = a, b, c, d; // Or however you get the value servletResponse = servletResponse.split(', '); // Split on the delimiter plus a space alert(servletResponse); // [a, b, c, d]; On Feb 3, 5:13 am, thomas.confuse choejens...@gmail.com wrote: Hi, all. i just started to use Jquery. i m using remote data to pass into jQuery widget, autocomplete. but the data from the servlet is generated in this format a, b,c, how can i break the data from the servlet to populate the autocomplete ? Please advice.i m using java for the servlet and the jsp page to for the form.
[jQuery] Re: Help creating a function
Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g. http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin
[jQuery] Re: Simple selector not working in 1.3.1 and webkit (safari and chrome)
That's odd. Could you file a bug on this? http://dev.jquery.com/newticket Thanks! --John On Tue, Feb 3, 2009 at 10:39 AM, Javier Martinez ecentin...@gmail.com wrote: I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6
[jQuery] Re: Using jQuery with Wordpress
Can you elaborate on having problems? On Feb 3, 8:57 am, MH1988 m.lawrencehu...@gmail.com wrote: I am having problems using jquery with wordpress. I would like to use the simple gallery plugin but it will not fade in/out my images. Help?
[jQuery] Re: Help creating a function
Try out the jQuery UI Scaling effect. http://docs.jquery.com/UI/Effects/Scale On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin
[jQuery] Re: How to enlarge size proportionally
Try the jQuery UI Scaling effect. http://docs.jquery.com/UI/Effects/Scale On Feb 3, 11:21 am, David .Wu chan1...@gmail.com wrote: Sorry for my bad explanation, I make a sample onlinehttp://chan.idv.tw/animate/enlarge.html On 2月3日, 下午11時11分, Eric Garside gars...@gmail.com wrote: Hmm. Lets say you need it to grow 100px. Would: $('#anim').animate({paddingLeft: 50, width: 50}); work? It's hard to say what would help without a better idea of what the element you want to grow looks like. On Feb 3, 9:34 am, David .Wu chan1...@gmail.com wrote: animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: Using jQuery with Wordpress
Is jQuery working at all? I've noticed that WordPress can be very intrusive when you put javascript in posts. When I would first write a post with js embedded it would work, but the instant I edited it online the helpful editor textbox would reformat my js and break it. If you want your gallery to be a permanent fixture (ie. On the side bar rather than just a single post) I would suggest you edit your theme directly. This should avoid any WordPress issues. Matt Penner -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MH1988 Sent: Tuesday, February 03, 2009 5:58 AM To: jQuery (English) Subject: [jQuery] Using jQuery with Wordpress I am having problems using jquery with wordpress. I would like to use the simple gallery plugin but it will not fade in/out my images. Help?
[jQuery] Re: Jquery cycle plugin - YouTube videos
Im trying to create a rotating promo area using the cycle plug-in. I have to to embed YouTube videos (example herehttp://www.grouptools.com/adrian/sbc-new/promo/) The main issue is FF works fine in that if a video is playing and you go to another 'slide' the video/sound stops. Where as IE7 continues to play the video and sound behind the scenes even when looking at other 'slides' Does anyone have any ideas how to fix this? Adi Cycle provides both 'before' and 'after' callbacks that you can use to play/stop your media accordingly.
[jQuery] Re: Help creating a function
Sorry for that last post, wrong thread. :( Anyway, you could try something like this: form input id=lim type=hidden value=40/ input id=input_1 type=text class=counter/ input id=input_2 type=text class=counter/ input id=input_3 type=text class=counter/ input id=input_4 type=text class=counter/ input id=input_5 type=text class=counter/ input id=input_6 type=text class=counter/ /form $(function(){ $('form').submit(function(){ var num = 0, lim = $('#lim').val()*1; $('input.counter').each(function(){ num += this.val()*1; }); if (num lim){ alert('You can't take more than ' + lim + ' bags, but you have selected ' + num + ' bags!'); return false; } }); }); On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin
[jQuery] Re: Ajax: not understanding 4th param of $.post( url, [data], [callback], [type] )
Basically, the 4th parameter tells jQuery what to do with the response data. JSON indicates you're expecting a JSON string as the post response. 'xml' indicates you want the return text parsed as XML (true AJAX). 'html' means it's coming in as, I think a jquery object. And text is just text. Those are the basic ones I've seen used most of the time. On Feb 3, 11:15 am, maggus.staab markus.st...@redaxo.de wrote: at api.jquery.com there is a well documented version.. @api doc devel: would be nice if we can link to a specific api page... On 3 Feb., 16:55, Professor B vtbludg...@gmail.com wrote: I have stared at the docs for a while and still don't understand the purpose of the option 4th parameter in the $.post() method. The wording and examples athttp://docs.jquery.com/Ajax/jQuery.postseemodd. E.g: [quote] Gets the test.php page contents which has been returned in json format (?php echo json_encode(array(name=John,time=2pm)); ?) $.post(test.php, { func: getNameAndTime }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, json); [/quote] We submit a POST request to test.php with parameter func = 'getNameAndTime' -- presumably for test.php's benefit so it can call that function, right? I think that's a little obscure in this example. Then we have an anonymous callback function that fires upon completion of a successful xhr request, its input parameter being 'data' which is the response body of the xhr object, right? In this instance, 'data' is an object -- a hash, an associative array, what have you. So if that's what it is, then it is what it is, so to speak. Is it not? I would expect that internally, JQuery would detect the content-type header indicating JSON and eval the xhr response body automatically. The server side would (and should) be responsible for sending the proper content-type. Am I to understand that in this example test.php might as well send plain old text/html, and the type hint json instructs JQuery to eval it?
[jQuery] Re: How to make Jquery work properly
Did you try adding jquery-1.2.3.js before adding jquery.cycle.js to the page? http://2whoa.com/dominate --- On Tue, 2/3/09, MH1988 m.lawrencehu...@gmail.com wrote: From: MH1988 m.lawrencehu...@gmail.com Subject: [jQuery] How to make Jquery work properly To: jQuery (English) jquery-en@googlegroups.com Date: Tuesday, February 3, 2009, 8:07 AM I have only been recently introduced to using JQuery and I am having basic problems of making it work. I previously used Takashi's MudCorp's Image Gallery but it came into conflict with the simple JQuery slideshow gallery I am implementing. What I have in my wordpress post is this: div id=section1 class=pics img src=/wp-content/uploads/ccp_invitation_no3_uk.jpg / img src=wp-content/uploads/arnsdorfss09_f.jpg / img src=wp-content/uploads/ccp_invitation_no3_uk.jpg / /div a id=prev href=#prev/anbsp;nbsp;nbsp;a id=next href=#next/a I've called my header with JQuery 1.2.3 and the JQuery Cycle Plugin 2.34. This is also in my header: script type=text/javascript $('#section1').cycle({ fx: 'fade', speed: 'fast', timeout: 0, next: '#next', prev: '#prev' }); /script and the page: a href=http://www.culturesinbetween.net/NEWWEBSITE/ archives/260website/a The fade transition does not work. Please help.
[jQuery] Re: find text within the page
yeah.. this finds it by classname (.keyword) , I need to be able to traverse all elements On Feb 3, 9:39 am, Eric Garside gars...@gmail.com wrote: Try: $(function(){ var keywords = [ ... ]; $.each(keywords, function(){ var kw = this, rx = new RegExp('/^ '+kw+' $/'); $(.keyword:contains('+kw+')) .each(function(){ $(this).text($(this).text().replace(rx, 'span'+kw+'/ span')); }); }); }); It's untested, but I think that should work? The Regex is adding whitespace to either side of the keyword intentionally, to only catch full words (so the RED fox gets matched but was near a REDwood tree. does not. Though, I'm not a regexpert, so I'm not positive what I've given you is the right way to go there, but hopefully it gives you a base to work from. On Feb 3, 10:20 am, paulinstl paulsha...@gmail.com wrote: Rob, My problem is that I have no way of knowing where the keyword may appear. It might be tabular data (TD) or in descriptive paragraph (p). So if my keyword is RED, then... BEFORE p the red fox /p AFTER pthe spanred/span fox/p I'll have an array of keywords as well. var arrayx[one, two three] On Feb 2, 5:57 pm, RobG rg...@iinet.net.au wrote: On Feb 3, 8:01 am, paulinstl paulsha...@gmail.com wrote: I'm looking for a way to locate keywords to help the end user out. For instance, if I want to find the word polar then i'd like my function to locate it, wrap it with a span, and assign it a function. so far I can locate using a content filter and classname like this... $(.keyword:contains('polar')) But this selects the whole element (paragraph, div, whatever) how do i focus in on JUST the text? The most reliable method is to traverse the part of the DOM you want to search and look at the value of text nodes. If you want to highlight a particular character pattern, use a regular expression and DOM methods to wrap it in a suitable element, say a span. It would also be prudent to also put adjacent text in spans too, e.g. divLorem ipsum dolor sit amet, consectetur adipiscing elit./dv might become: divspanLorem ipsum /spanspan class=foodolor/span span sit amet, consectetur adipiscing elit./span/dv That way you can also deal with text found inside elements like B or QUOTE if necessary. Other approaches such as using a regular exprssion and an element's innerHTML property, are likely to be error prone. -- Rob- Hide quoted text - - Show quoted text -
[jQuery] Re: about :not(:last)
It's not a bug, it's the documented behavior: :first Matches the first selected element. http://docs.jquery.com/Selectors/first Let's go through it again. When you call $(this).parents() you get this array of elements: [0] dd [1] dl [2] dd [3] dl [4] dd [5] dl Which are all the element's parents, in order. That's the collection you're dealing with. Now, :first refers to the first element ([0]) in that set, and only that, it has no other meaning. So dl:first will match nothing, as no dl is the ':first' element. dd:first will match the same as dd:eq(0) or simply :first. You have to take in account that the pseudo-selectors are a set of defined filters, there is no 'semantic' in them. Maybe this could be improved, but that would be a change in syntax, not a 'bug correction'. Again, that's what slice() is for, slicing the array of elements as you wish. cheers, - ricardo On Feb 3, 12:28 am, Garito gar...@gmail.com wrote: Sorry, Ricardo, but this isn't so much logic, isn't it? When I see dl:not(:first) I read give me all dl except the first one Imagine this was a mathematics expression We read from left to right: first filter all dl's with the result exclude the first one I can understand a bug but it's dificult to me to understand your explanation about this issue even when I test the code with the iPhone safari (on Wednesday I could try it with IE to see the dl supposed, on FF or Safari don't appears, problem you point) I don't know who decides (at jQuery) what is a bug and what isn't but in my opinion this is one of them If jQuery people wants to correct them, ok If not ok but jQuery will have it's first point to leave it as soon as a better library appears I can do anything more that change my code to solve this jQuery bug but this don't change the fact that there is a bug at jQuery Thanks On 3 feb, 02:32, Ricardo Tomasi ricardob...@gmail.com wrote: I haven't seen your page, but I know that styling dd and dt elements for IE is a pain. And the invalid mark-up might bring you problems with different browsers. The usual behavior for invalid nesting is to close the offended tag to make it valid, so this dl dt div/div /dt dd/ /dl would become dl dt /dt /dl div/div dl dd/ /dl Firefox is surprisingly tolerant in this case, but I haven't tested elsewhere. Valid mark-up is a safe harbour specially with regards to DOM manipulation. That aside, I found the issue, it's actually quite simple. this.parents('dl:not(:first)') let's see what's happening: - first, this gets you all the parents() for 'root'. Without any filtering, that would be DD, DL, DD, DL etc. - then you ask it to filter the elements which are 'DL's AND are not the first match. Here's the catch: :first refers to the first match in the set, which is a DD element, not a DL one. The DL is never going to be the first match. :first will always filter according to the current set, before any other expressions in the same call are evaluated. So what you need to do is filter the parents set again: var slots = $(this).parents('dl').filter(':not(:first)').map(function () { return $(.Texto:first, $(this)).text(); } Or use slice() instead as I posted before, that will be much faster as you're just slicing the array without dealing with elements/selectors. var slots = $(this).parents('dl').slice(1).map(function() { return $(.Texto:first, $(this)).text(); } cheers, - ricardo On Feb 2, 11:35 am, Garito gar...@gmail.com wrote: Sorry Ricardo but you say the problem is the dt element? With this markup I can do what I need in terms of css With the css I put the divs inside the dt element to put a label, the icon and the other div to switch between visible/non visible dd How do you think I could put my markup to avoid this problem? I don't like your suggest because one of the main reasons to change from prototype to jquery was the css's selectors and they power I thinks this is a jquery's bug, isn't it? On 2 feb, 10:02, Ricardo Tomasi ricardob...@gmail.com wrote: Ah that's quite confusing mark-up. A dt element can only contain inline elements, certainly not divs and other definition lists. Nested definition lists make no sense! I couldn't find the problem. Try $(this).parents('dl').slice(1) or $(this).parents('dl').slice (0,-1), that will probably work. cheers, - ricardo On Feb 1, 10:57 pm,Garitogar...@gmail.com wrote: Gracias, Ricardo! I change the code with the complete test case for my issue Sorry for the identation but the original code is generated and I copy/ paste with firebug If I'm not wrong, with the selector 'dl:not(:last)' SITE dl is incorrect in the returned list because is the last dl (if not 'dl' will be equal to 'dl:not(:last)') am I confused or there is a bug?
[jQuery] Re: UI Tabs - change onClick behaviour
Try: $('#menu_zakladka3').unbind('click').click(function(){ window.location = 'http://some.url'; return false; }); I think that should work fine? On Feb 2, 5:48 pm, plusz pluszpica...@googlemail.com wrote: I have 6 tabs. I changed event to load tab content on hover for tab 'menu_zakladka3' I need to open page HTTP://SOMEURL instead of opening tab or load ajax data (this page has to read variables from the page header and check some cookies, so it is easier to not load with AJAX) How to do this? my code $(#nawigacjazarzadzanie ul).tabs({ event: 'mouseover' }); ul class=zakladkizarzadzanie li id=menu_zakladka1a href=#zakladka1spanTwoje dane/ span/a/li li id=menu_zakladka2a href=#zakladka2spanUstawienia firmowe/span/a/li li id=menu_zakladka3a href=HTTP://SOMEURLspanCLICK TO OPEN A PAGE/span/a/li li id=menu_zakladka4a href=#zakladka4spanUstawienia firmowe/span/a/li /ul /div div style=clear:both/div div id=zakladka1 class=level2 DIV1 /div div id=zakladka2 class=level2 DIV 2/div div id=zakladka3 class=level2/div div id=zakladka4 class=level2 DIV 4/div
[jQuery] Re: Ajax: not understanding 4th param of $.post( url, [data], [callback], [type] )
@Eric I think I get it. So I assume -- again, using this example -- if your server returned json content AND the appropriate header, you were expecting json and you did NOT pass 'json' as the 4th param to $.post(), then data.name etc would be undefined. Right? And conversely, if your server returned JSON but failed to indicate the content-type as json but you DID tell $.post() it's JSON, then bla bla bla it would work. Right? I should test it and see for myself, I know. @maggus.staab Thanks for the tip, I will have a look. On Feb 3, 11:52 am, Eric Garside gars...@gmail.com wrote: Basically, the 4th parameter tells jQuery what to do with the response data. JSON indicates you're expecting a JSON string as the post response. 'xml' indicates you want the return text parsed as XML (true AJAX). 'html' means it's coming in as, I think a jquery object. And text is just text. Those are the basic ones I've seen used most of the time. On Feb 3, 11:15 am, maggus.staab markus.st...@redaxo.de wrote: at api.jquery.com there is a well documented version.. @api doc devel: would be nice if we can link to a specific api page... On 3 Feb., 16:55, Professor B vtbludg...@gmail.com wrote: I have stared at the docs for a while and still don't understand the purpose of the option 4th parameter in the $.post() method. The wording and examples athttp://docs.jquery.com/Ajax/jQuery.postseemodd. E.g: [quote] Gets the test.php page contents which has been returned in json format (?php echo json_encode(array(name=John,time=2pm)); ?) $.post(test.php, { func: getNameAndTime }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, json); [/quote] We submit a POST request to test.php with parameter func = 'getNameAndTime' -- presumably for test.php's benefit so it can call that function, right? I think that's a little obscure in this example. Then we have an anonymous callback function that fires upon completion of a successful xhr request, its input parameter being 'data' which is the response body of the xhr object, right? In this instance, 'data' is an object -- a hash, an associative array, what have you. So if that's what it is, then it is what it is, so to speak. Is it not? I would expect that internally, JQuery would detect the content-type header indicating JSON and eval the xhr response body automatically. The server side would (and should) be responsible for sending the proper content-type. Am I to understand that in this example test.php might as well send plain old text/html, and the type hint json instructs JQuery to eval it?
[jQuery] Re: Jquery.js include multiple times header / footer / etc.
Hi Jim and Eric, I did a bit of testing around, and what I found is that i I want to include a js file from my js code, I'll need to have that script end, before the .js is loaded. So I tried a couple of things and the following now works : script language=JavaScript type=text/javascript function jsInclude(jsFile) { document.write('' + 'script'); document.write(' language=JavaScript'); document.write(' type=text/javascript'); document.write(' src=' + jsFile + ''); document.write('/' + 'script' + ''); } // jquery.js if (typeof($) != function) { // jquery.js not included... include it jsInclude(/_js/jquery.js); } /script script language=JavaScript type=text/javascript // jquery.cookie.js if (typeof($.cookie) != function) { // jquery.cookie.js not included... include it jsInclude(/_js/jquery.cookie.js); } /script script language=JavaScript type=text/javascript alert(Type1 : + typeof($)); alert(Type2 : + typeof($.cookie)); [...] So this works, but on a scale from 1 to 10, on the ugliness of the whole thing, I think I'd give it a 8 or 9 hehe :) I'll probably send my jsInclude function in my main .js file... So I'll have two script like that, just sitting there... what you guys think ? (These events are occuring in the footer.jsp file of my site which is on every page.) Thanks for the help! On 3 fév, 09:19, Eric Garside gars...@gmail.com wrote: Honestly, best practice here is to redo how you include javascript. Sad, but true. :( On Feb 3, 9:15 am, Jim D nofxbassist1...@gmail.com wrote: You could check whether or not $ is a function. If jQuery has been included, typeof($) should return the string function otherwise it will return undefined On Feb 2, 11:32 am, Sébastien Richer sebastienric...@gmail.com wrote: Hi, I tried to search around for this but have'nt had any luck, so I'll ask here :) I use jquery.js on most of my sites. And most pages have it included in the head part. But not all of my pages, some are very old. Along with jquery.js, most pages also have jquery.flash.js. Now I recently needed to add something to my footer (which is included on every page) and I need to user jquery.cookie.js, and so jquery.js. Since not all my pages have jquery.js, I included in my footer both jquery.js and jquery.cookie.js. The problem is that when I include jquery.js a second time, the initial instance (?) seams to be forgotten and now my jquery.flash.js seams to have stopped working. I get an unresolved for flash(). Anyone had a similar issue ? (If I'm not mistaking this is an issue only with the latest versions of jquery.js) Any workarounds ? My backup plan will be to go around all of my pages and change the way I call .js files. I'll probably create a javascript.jsp file and include that in all my pages and control it from there. bleh... find and replace... Thanks for the help !
[jQuery] Re: Jquery cycle plugin - YouTube videos
Thanks Mike. I dont suppose you have a quick demo, or code to hand to show me how this would be done. Would be most appreciated... Adi On Feb 3, 4:46 pm, Mike Alsup mal...@gmail.com wrote: Im trying to create a rotating promo area using the cycle plug-in. I have to to embed YouTube videos (example herehttp://www.grouptools.com/adrian/sbc-new/promo/) The main issue is FF works fine in that if a video is playing and you go to another 'slide' the video/sound stops. Where as IE7 continues to play the video and sound behind the scenes even when looking at other 'slides' Does anyone have any ideas how to fix this? Adi Cycle provides both 'before' and 'after' callbacks that you can use to play/stop your media accordingly.
[jQuery] Re: toggle checkbox when clicking td
Hello again, Thanks a lot for pointing out the problem in the tutorial. I have fixed it to work for 1.3.1: http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click#update1 --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 2, 2009, at 10:37 PM, Karl Swedberg wrote: On Feb 2, 2009, at 6:47 PM, Slafs wrote: Karl thanks for your tutorial. But it seems that examples for adding the selected class doesn't work when I click the row but only the checkbox itself Well, that is very strange. It works with jQuery 1.2.6, but not with 1.3.1. Hmm. Will have to investigate. (and it doesn't work at all on Konqueror). I don't have Konqueror, but I'll take your word for it. Wonder if it's related to the other issue. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Ajax: not understanding 4th param of $.post( url, [data], [callback], [type] )
I'm not positive how jQuery handles mismatched response expectations. Testing it for yourself would be the best way to go, if you're worried about it. But your best case is to specify your expected return, if only to keep a record somewhere of what you should be getting back. On Feb 3, 12:06 pm, Professor B vtbludg...@gmail.com wrote: @Eric I think I get it. So I assume -- again, using this example -- if your server returned json content AND the appropriate header, you were expecting json and you did NOT pass 'json' as the 4th param to $.post(), then data.name etc would be undefined. Right? And conversely, if your server returned JSON but failed to indicate the content-type as json but you DID tell $.post() it's JSON, then bla bla bla it would work. Right? I should test it and see for myself, I know. @maggus.staab Thanks for the tip, I will have a look. On Feb 3, 11:52 am, Eric Garside gars...@gmail.com wrote: Basically, the 4th parameter tells jQuery what to do with the response data. JSON indicates you're expecting a JSON string as the post response. 'xml' indicates you want the return text parsed as XML (true AJAX). 'html' means it's coming in as, I think a jquery object. And text is just text. Those are the basic ones I've seen used most of the time. On Feb 3, 11:15 am, maggus.staab markus.st...@redaxo.de wrote: at api.jquery.com there is a well documented version.. @api doc devel: would be nice if we can link to a specific api page... On 3 Feb., 16:55, Professor B vtbludg...@gmail.com wrote: I have stared at the docs for a while and still don't understand the purpose of the option 4th parameter in the $.post() method. The wording and examples athttp://docs.jquery.com/Ajax/jQuery.postseemodd. E.g: [quote] Gets the test.php page contents which has been returned in json format (?php echo json_encode(array(name=John,time=2pm)); ?) $.post(test.php, { func: getNameAndTime }, function(data){ alert(data.name); // John console.log(data.time); // 2pm }, json); [/quote] We submit a POST request to test.php with parameter func = 'getNameAndTime' -- presumably for test.php's benefit so it can call that function, right? I think that's a little obscure in this example. Then we have an anonymous callback function that fires upon completion of a successful xhr request, its input parameter being 'data' which is the response body of the xhr object, right? In this instance, 'data' is an object -- a hash, an associative array, what have you. So if that's what it is, then it is what it is, so to speak. Is it not? I would expect that internally, JQuery would detect the content-type header indicating JSON and eval the xhr response body automatically. The server side would (and should) be responsible for sending the proper content-type. Am I to understand that in this example test.php might as well send plain old text/html, and the type hint json instructs JQuery to eval it?
[jQuery] Re: Jquery cycle plugin - YouTube videos
I dont suppose you have a quick demo, or code to hand to show me how this would be done. Would be most appreciated... Hmm, I thought I did but can seem to find it. It depends what functions are exposed on the element so you may want to google it. Maybe someone else will chime in with a suggestion.
[jQuery] Tooltip Issue
Dear Folk I'm going to use a tooltip in my website I was wondering which one of these ToolTips In the Internet is great . thanks
[jQuery] Re: find text within the page
Replace $(.keyword:contains('+kw+')) .each(function(){ With $(:contains('+kw+')).each(function(){ On Feb 3, 11:54 am, paulinstl paulsha...@gmail.com wrote: yeah.. this finds it by classname (.keyword) , I need to be able to traverse all elements On Feb 3, 9:39 am, Eric Garside gars...@gmail.com wrote: Try: $(function(){ var keywords = [ ... ]; $.each(keywords, function(){ var kw = this, rx = new RegExp('/^ '+kw+' $/'); $(.keyword:contains('+kw+')) .each(function(){ $(this).text($(this).text().replace(rx, 'span'+kw+'/ span')); }); }); }); It's untested, but I think that should work? The Regex is adding whitespace to either side of the keyword intentionally, to only catch full words (so the RED fox gets matched but was near a REDwood tree. does not. Though, I'm not a regexpert, so I'm not positive what I've given you is the right way to go there, but hopefully it gives you a base to work from. On Feb 3, 10:20 am, paulinstl paulsha...@gmail.com wrote: Rob, My problem is that I have no way of knowing where the keyword may appear. It might be tabular data (TD) or in descriptive paragraph (p). So if my keyword is RED, then... BEFORE p the red fox /p AFTER pthe spanred/span fox/p I'll have an array of keywords as well. var arrayx[one, two three] On Feb 2, 5:57 pm, RobG rg...@iinet.net.au wrote: On Feb 3, 8:01 am, paulinstl paulsha...@gmail.com wrote: I'm looking for a way to locate keywords to help the end user out. For instance, if I want to find the word polar then i'd like my function to locate it, wrap it with a span, and assign it a function. so far I can locate using a content filter and classname like this... $(.keyword:contains('polar')) But this selects the whole element (paragraph, div, whatever) how do i focus in on JUST the text? The most reliable method is to traverse the part of the DOM you want to search and look at the value of text nodes. If you want to highlight a particular character pattern, use a regular expression and DOM methods to wrap it in a suitable element, say a span. It would also be prudent to also put adjacent text in spans too, e.g. divLorem ipsum dolor sit amet, consectetur adipiscing elit./dv might become: divspanLorem ipsum /spanspan class=foodolor/span span sit amet, consectetur adipiscing elit./span/dv That way you can also deal with text found inside elements like B or QUOTE if necessary. Other approaches such as using a regular exprssion and an element's innerHTML property, are likely to be error prone. -- Rob- Hide quoted text - - Show quoted text -
[jQuery] Re: How to enlarge size proportionally
yup, I tried, but still not know to to do it proportionally. sigh.. On 2月4日, 上午12時43分, Eric Garside gars...@gmail.com wrote: Try the jQuery UI Scaling effect. http://docs.jquery.com/UI/Effects/Scale On Feb 3, 11:21 am, David .Wu chan1...@gmail.com wrote: Sorry for my bad explanation, I make a sample onlinehttp://chan.idv.tw/animate/enlarge.html On 2月3日, 下午11時11分, Eric Garside gars...@gmail.com wrote: Hmm. Lets say you need it to grow 100px. Would: $('#anim').animate({paddingLeft: 50, width: 50}); work? It's hard to say what would help without a better idea of what the element you want to grow looks like. On Feb 3, 9:34 am, David .Wu chan1...@gmail.com wrote: animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: Performance suggestion: Use object hash instead of regexp
Absolutely, it is very very limited. So this technique is only suited to the type of regex's that I quoted, like the one used internally by jquery to test for body or html tags only, or to test for t(able|d|h) only. Particulalry when used inside a loop. For parsing a selector we still need regex. On Feb 3, 3:16 pm, Eric Garside gars...@gmail.com wrote: Using a hash I can see for some situations, but unless you can figure out a way (and I'd be super interested if you could) to do complex cascade parsing without regex, your method seems like double the work of rewriting with no benefits towards maintainability and a minor speed increase for only certain tags.
[jQuery] Re: Problem with Chrome firing events correctly
Sure, here you go // begin code // var cookie_name = 'WP_LiveSaver', element = 'wpTextbox1'; var LiveSaver = { init: function() { this.lastSave = (new Date()).getTime(); var wikiSection = window.location.href.match(/section=\d+/), wikiPage = wgTitle; if(!wikiPage) { return false; } else { if(wikiSection) { wikiPage += '' + wikiSection[0]; } } this.page = wikiPage; this.data = {}; // Add icon to the top left corner of window $('#p-personal div.pBody ul').append('li id=LiveSaverIcon/ li'); this.cookie = new LiveSaverCookie(); var tmpData = JSON.parse(this.cookie.load()); if(tmpData) { this.data = tmpData; } // Check if extension is disabled or enabled if(typeof this.data.enabled === 'undefined' || this.data.enabled === true) { this.enable(); } else { this.disable(); } }, enable: function() { // Set save threshold to 2.5 seconds this.saveThreshold = 2500; $('#LiveSaverIcon') .css('background-position', '0 center') .attr('title', 'LiveSaver ' + LiveSaver_version + ' Click to disable'); if(!this.data[this.page]) { this.data[this.page] = {}; } if(!this.data[this.page][element]) { this.data[this.page][element] = ''; } if(!this.data[this.page]['rev']) { this.data[this.page]['rev'] = ''; } this.data.enabled = this.enabled = true; this.save(); }, disable: function() { // Set very high save threshold to save browser resources this.saveThreshold = 500; $('#LiveSaverIcon') .css('background-position', '-16px center') .attr('title', 'LiveSaver ' + LiveSaver_version + ' Click to enable'); // Remove all existing data this.data = {}; this.data.enabled = this.enabled = false; this.save(); }, register: function() { // The readonly attribute is set when the current user doesn't have access to editing the current page. if($('#' + element).attr('readonly') === true) { return; } // Check if this page has been previously saved in the cookie if(this.enabled === true this.has(element)) { //get saved data var value = this.get(element); if($('#' + element).val() != value) { if(this.data[this.page]['rev'] != wgCurRevisionId) { $('#editform').before('div id=noticepThis page has changed since you started editing it./p/div'); return; } else { // Append warning message $('#editform').before('div id=noticepThere is an autosave of this page that is more recent than the version below. a href= id=LiveSaver_RestoreRestore old version/a./p/div'); // Wait for user to decide to move to new version. $('#LiveSaver_Restore').click(function(e) { // Prevent link from being followed e.preventDefault(); // Replace text $('#' + element).val(LiveSaver.get(element)); // Remove notice $('#notice').remove(); }); } } } // Watch for multiple events in the textbox $('#' + element).bind('keyup focus blur', function() { // Check if enough time has passed if(LiveSaver.enabled === true ((new Date()).getTime() - LiveSaver.lastSave) LiveSaver.saveThreshold) { // Update last saved time LiveSaver.lastSave = (new Date()).getTime(); //
[jQuery] Re: Performance suggestion: Use object hash instead of regexp
In that case, wouldn't a switch statement have even less overhead than creating an object to check everytime? I'd think switch(tag){case 'body':case 'html': /* ... */ break;} would be an even faster solution, no? On Feb 3, 12:39 pm, George Adamson george.adam...@softwareunity.com wrote: Absolutely, it is very very limited. So this technique is only suited to the type of regex's that I quoted, like the one used internally by jquery to test for body or html tags only, or to test for t(able|d|h) only. Particulalry when used inside a loop. For parsing a selector we still need regex. On Feb 3, 3:16 pm, Eric Garside gars...@gmail.com wrote: Using a hash I can see for some situations, but unless you can figure out a way (and I'd be super interested if you could) to do complex cascade parsing without regex, your method seems like double the work of rewriting with no benefits towards maintainability and a minor speed increase for only certain tags.
[jQuery] Re: How to enlarge size proportionally
yup, I tried, but still not know to to do it proportionally. sigh.. Look at the technique used in this plugin: http://www.malsup.com/jquery/hoverpulse/
[jQuery] Re: Jquery cycle plugin - YouTube videos
Thanks for looking, cant see much on Google at the moment apart from people having similar problems with flash video when they try and make it display:none (which is esentially cycle plug-in is doing) Anybody else have any code for this? I will keep hunting and post back here if I come across anything... On Feb 3, 5:27 pm, Mike Alsup mal...@gmail.com wrote: I dont suppose you have a quick demo, or code to hand to show me how this would be done. Would be most appreciated... Hmm, I thought I did but can seem to find it. It depends what functions are exposed on the element so you may want to google it. Maybe someone else will chime in with a suggestion.
[jQuery] Re: How to enlarge size proportionally
thanks, this plugin is really cool. On 2月4日, 上午1時50分, Mike Alsup mal...@gmail.com wrote: yup, I tried, but still not know to to do it proportionally. sigh.. Look at the technique used in this plugin: http://www.malsup.com/jquery/hoverpulse/
[jQuery] Re: Help creating a function
Looking good Eric, i tied it out, but it doenst seem to work. I already fixed the bug in the alert with the ' in it, but no reponse when filling in alot of numbers. On 3 feb, 17:48, Eric Garside gars...@gmail.com wrote: Sorry for that last post, wrong thread. :( Anyway, you could try something like this: form input id=lim type=hidden value=40/ input id=input_1 type=text class=counter/ input id=input_2 type=text class=counter/ input id=input_3 type=text class=counter/ input id=input_4 type=text class=counter/ input id=input_5 type=text class=counter/ input id=input_6 type=text class=counter/ /form $(function(){ $('form').submit(function(){ var num = 0, lim = $('#lim').val()*1; $('input.counter').each(function(){ num += this.val()*1; }); if (num lim){ alert('You can't take more than ' + lim + ' bags, but you have selected ' + num + ' bags!'); return false; } }); }); On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] Re: Need solution for select element value change...
It sounds to me like you want the .change event to fire if someone selects an option that's already selected. If that's the case, try this: $(function(){ $('.agents') .focus(function(){ $('option:selected', this).attr('selected', ''); }) .change(function(){ // Your function here? }); }); Otherwise, I might not quite understand the problem. Can you give an HTML sample? On Feb 3, 9:39 am, Rick Faircloth r...@whitestonemedia.com wrote: Hi, all... Here's the code: $(document).ready(function() { $('.agents').change(function() { $('option:selected', this).each(function() { Here's the problem: I would like for the function triggered in the code above by .change to work if the same value is chosen in the select element .agents. Right now, the function following .change is only triggered if another value is selected. I tried .select, but that didn't work. I tried .click, too, but that wasn't satisfactory. Anyone have another option? Thanks, Rick
[jQuery] Re: How to enlarge size proportionally
but is that mean I have to write lots code to do what I want? actually I know the trick, just want to know can it complete through jQuery effect by only set the options. On 2月4日, 上午1時55分, David .Wu chan1...@gmail.com wrote: thanks, this plugin is really cool. On 2月4日, 上午1時50分, Mike Alsup mal...@gmail.com wrote: yup, I tried, but still not know to to do it proportionally. sigh.. Look at the technique used in this plugin: http://www.malsup.com/jquery/hoverpulse/
[jQuery] Re: How to enlarge size proportionally
$('#anim').animate({marginLeft: '-=50', width: '+=100'}); or $('#anim').css('position', 'relative').animate({left -50, width: '+=100'}); On Feb 3, 1:11 pm, Eric Garside gars...@gmail.com wrote: Hmm. Lets say you need it to grow 100px. Would: $('#anim').animate({paddingLeft: 50, width: 50}); work? It's hard to say what would help without a better idea of what the element you want to grow looks like. On Feb 3, 9:34 am, David .Wu chan1...@gmail.com wrote: animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: Help creating a function
Ah, I'm pretty sure i missed wrapping the loop's this in a jQuery obj Try replacing this line: num += this.val()*1; with num += $(this).val()*1; Also, do an alert before and after the loop and just see what the values are: alert('Limit: ' + lim + \nNum: + num); On Feb 3, 12:58 pm, ebru...@gmail.com ebru...@gmail.com wrote: Looking good Eric, i tied it out, but it doenst seem to work. I already fixed the bug in the alert with the ' in it, but no reponse when filling in alot of numbers. On 3 feb, 17:48, Eric Garside gars...@gmail.com wrote: Sorry for that last post, wrong thread. :( Anyway, you could try something like this: form input id=lim type=hidden value=40/ input id=input_1 type=text class=counter/ input id=input_2 type=text class=counter/ input id=input_3 type=text class=counter/ input id=input_4 type=text class=counter/ input id=input_5 type=text class=counter/ input id=input_6 type=text class=counter/ /form $(function(){ $('form').submit(function(){ var num = 0, lim = $('#lim').val()*1; $('input.counter').each(function(){ num += this.val()*1; }); if (num lim){ alert('You can't take more than ' + lim + ' bags, but you have selected ' + num + ' bags!'); return false; } }); }); On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] How to enlarge size proportionally
animate function can change object's size by control css, such as width and height, if if we want to increase the width, the width increased to right - how to do it like below - -
[jQuery] Re: Help creating a function
I get it now. I didn't add a submit button. Do you now if it's also possible to use it without pressing on the submit so it would be a realtime check. On 3 feb, 19:08, Eric Garside gars...@gmail.com wrote: Ah, I'm pretty sure i missed wrapping the loop's this in a jQuery obj Try replacing this line: num += this.val()*1; with num += $(this).val()*1; Also, do an alert before and after the loop and just see what the values are: alert('Limit: ' + lim + \nNum: + num); On Feb 3, 12:58 pm, ebru...@gmail.com ebru...@gmail.com wrote: Looking good Eric, i tied it out, but it doenst seem to work. I already fixed the bug in the alert with the ' in it, but no reponse when filling in alot of numbers. On 3 feb, 17:48, Eric Garside gars...@gmail.com wrote: Sorry for that last post, wrong thread. :( Anyway, you could try something like this: form input id=lim type=hidden value=40/ input id=input_1 type=text class=counter/ input id=input_2 type=text class=counter/ input id=input_3 type=text class=counter/ input id=input_4 type=text class=counter/ input id=input_5 type=text class=counter/ input id=input_6 type=text class=counter/ /form $(function(){ $('form').submit(function(){ var num = 0, lim = $('#lim').val()*1; $('input.counter').each(function(){ num += this.val()*1; }); if (num lim){ alert('You can't take more than ' + lim + ' bags, but you have selected ' + num + ' bags!'); return false; } }); }); On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] Re: Jquery.js include multiple times header / footer / etc.
You could check whether or not $ is a function. If jQuery has been included, typeof($) should return the string function otherwise it will return undefined On Feb 2, 11:32 am, Sébastien Richer sebastienric...@gmail.com wrote: Hi, I tried to search around for this but have'nt had any luck, so I'll ask here :) I use jquery.js on most of my sites. And most pages have it included in the head part. But not all of my pages, some are very old. Along with jquery.js, most pages also have jquery.flash.js. Now I recently needed to add something to my footer (which is included on every page) and I need to user jquery.cookie.js, and so jquery.js. Since not all my pages have jquery.js, I included in my footer both jquery.js and jquery.cookie.js. The problem is that when I include jquery.js a second time, the initial instance (?) seams to be forgotten and now my jquery.flash.js seams to have stopped working. I get an unresolved for flash(). Anyone had a similar issue ? (If I'm not mistaking this is an issue only with the latest versions of jquery.js) Any workarounds ? My backup plan will be to go around all of my pages and change the way I call .js files. I'll probably create a javascript.jsp file and include that in all my pages and control it from there. bleh... find and replace... Thanks for the help !
[jQuery] [plugins] [jcarousel] Add new item
Hi all, I'm trying to add new item on the fly with jcarousel. The function itemLoadCallback, didn't work to add item when you want. The plugin is build like this : $.fn.jcarousel = function(o) { return this.each(function() { new $jc(this, o); }); }; $.jcarousel = function(e, o) { ... } $.jcarousel.fn.extend({ setup: function() { } }); If i want to add an new function, how could i access her ? I want to do something like that : $('ul').jcarousel(); $('ul').jcarousel('add',options);
[jQuery] Live Event Firing Multiple Times Instead of Just Once?
I have the following code: $(#element_id).live(mousedown, function(event){ ChangeView(); return false; }); When $(#element_id) is clicked, the ChangeView() function is called not once, but multiple times. I see the following listing in the Firebug Stack pane: ChangeView() complete() (?)() dequeue() dequeue() each() each() dequeue() complete() (?)() dequeue() dequeue() each() each() dequeue() complete() step() t (?)() dequeue() is a jQuery function. I thought if I included: return false; ...the live event would only be called once. How can I correct this? Thanks very much in advance to all for any info.
[jQuery] Re: Jquery.js include multiple times header / footer / etc.
Honestly, best practice here is to redo how you include javascript. Sad, but true. :( On Feb 3, 9:15 am, Jim D nofxbassist1...@gmail.com wrote: You could check whether or not $ is a function. If jQuery has been included, typeof($) should return the string function otherwise it will return undefined On Feb 2, 11:32 am, Sébastien Richer sebastienric...@gmail.com wrote: Hi, I tried to search around for this but have'nt had any luck, so I'll ask here :) I use jquery.js on most of my sites. And most pages have it included in the head part. But not all of my pages, some are very old. Along with jquery.js, most pages also have jquery.flash.js. Now I recently needed to add something to my footer (which is included on every page) and I need to user jquery.cookie.js, and so jquery.js. Since not all my pages have jquery.js, I included in my footer both jquery.js and jquery.cookie.js. The problem is that when I include jquery.js a second time, the initial instance (?) seams to be forgotten and now my jquery.flash.js seams to have stopped working. I get an unresolved for flash(). Anyone had a similar issue ? (If I'm not mistaking this is an issue only with the latest versions of jquery.js) Any workarounds ? My backup plan will be to go around all of my pages and change the way I call .js files. I'll probably create a javascript.jsp file and include that in all my pages and control it from there. bleh... find and replace... Thanks for the help !
[jQuery] Re: Jquery.js include multiple times header / footer / etc.
jQuery does provide a $.getScript function that replicates your jsInclude functionality. I've also written a quick snippet that you might find beneficial. It does automatic script includes based on your other script tags. For example, if you add the small plugin I wrote and have the following script tag: script type=text/javascript src=/path/to/jquery.js? ui.jquery.min,footer.min/script Once the document is ready, jQuery will backload /path/to/ui.jquery.min.js and /path/to/footer.min.js My script is located here: http://snipplr.com/view/10368/jquery-automatic-script-includer/ There's also some pretty decent onDemand loading libraries out there, which you may also find useful: http://www.google.com/search?q=on+demand+javascript On Feb 3, 12:09 pm, Sébastien Richer sebastienric...@gmail.com wrote: Hi Jim and Eric, I did a bit of testing around, and what I found is that i I want to include a js file from my js code, I'll need to have that script end, before the .js is loaded. So I tried a couple of things and the following now works : script language=JavaScript type=text/javascript function jsInclude(jsFile) { document.write('' + 'script'); document.write(' language=JavaScript'); document.write(' type=text/javascript'); document.write(' src=' + jsFile + ''); document.write('/' + 'script' + ''); } // jquery.js if (typeof($) != function) { // jquery.js not included... include it jsInclude(/_js/jquery.js); } /script script language=JavaScript type=text/javascript // jquery.cookie.js if (typeof($.cookie) != function) { // jquery.cookie.js not included... include it jsInclude(/_js/jquery.cookie.js); } /script script language=JavaScript type=text/javascript alert(Type1 : + typeof($)); alert(Type2 : + typeof($.cookie)); [...] So this works, but on a scale from 1 to 10, on the ugliness of the whole thing, I think I'd give it a 8 or 9 hehe :) I'll probably send my jsInclude function in my main .js file... So I'll have two script like that, just sitting there... what you guys think ? (These events are occuring in the footer.jsp file of my site which is on every page.) Thanks for the help! On 3 fév, 09:19, Eric Garside gars...@gmail.com wrote: Honestly, best practice here is to redo how you include javascript. Sad, but true. :( On Feb 3, 9:15 am, Jim D nofxbassist1...@gmail.com wrote: You could check whether or not $ is a function. If jQuery has been included, typeof($) should return the string function otherwise it will return undefined On Feb 2, 11:32 am, Sébastien Richer sebastienric...@gmail.com wrote: Hi, I tried to search around for this but have'nt had any luck, so I'll ask here :) I use jquery.js on most of my sites. And most pages have it included in the head part. But not all of my pages, some are very old. Along with jquery.js, most pages also have jquery.flash.js. Now I recently needed to add something to my footer (which is included on every page) and I need to user jquery.cookie.js, and so jquery.js. Since not all my pages have jquery.js, I included in my footer both jquery.js and jquery.cookie.js. The problem is that when I include jquery.js a second time, the initial instance (?) seams to be forgotten and now my jquery.flash.js seams to have stopped working. I get an unresolved for flash(). Anyone had a similar issue ? (If I'm not mistaking this is an issue only with the latest versions of jquery.js) Any workarounds ? My backup plan will be to go around all of my pages and change the way I call .js files. I'll probably create a javascript.jsp file and include that in all my pages and control it from there. bleh... find and replace... Thanks for the help !
[jQuery] Re: DIV position
If I'm correct, your callback inside your show() function cannot include parameters. Instead of: $('#profile_' + id).show(slow, hideAllProfile(id)); Use: $('#profile_' + id).show(slow, function() { hideAllProfile(id); }); On Feb 3, 1:22 am, Paresh pareshva...@gmail.com wrote: Is there any way to set the z-index of the div? I have series of hidden DIVs (in each row of table and clicking any of those would pop-up a information guide) Here is my code: function showProfile(id) { $('#profile_' + id).show(slow, hideAllProfile (id)); } function hideAllProfile(id) { $(.profilePopup:not(#profile_ + id + )).hide(); } This works fine for me on IE browsers. However putting my DIV behind the table cell on other browsers. Even setting z-index for the DIV is not working in this case. Please help! Thanks, Paresh
[jQuery] Math.ceil rounds down instead of up!?
I've finished my shipping calculator script, but now for some reason Math.ceil used on var sum in my script does the opposite of what it's supposed to! When it's used in an older version of my script it works correctly so I would assume I've done something wrong that's borking the script now. This script correctly rounds up the totalweight to the next whole number: html head script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function() { $(#calculateweight).click(function() { var sum = 0; $(input[name*='weight']).each(function() { sum += Number($(this).val()); }); $(#totalweight).text( Math.ceil(sum) ); return false; }); }); /script /script /head body form input type=hidden name=weight1 value=1.1 /form button id=calculateweightCalculate Price/buttonbr / Total Weight: span id=totalweight/spanbr / /body /html --- My shipping script does the opposite, it always rounds down the total weight even if the result is a whole number: --- html head script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function() { var totalweight = 0; var zipcode = 0; var shortzip = 000; var zonearray = new Array(005-212 8,214-268 8,270-342 8,344-344 8,346-347 8,349-352 8, 354-418 8,420-427 8,430-462 8,463-464 7,465-497 8,498-509 7,510-513 6,514-514 7,515-516 6, 520-528 7,530-532 7,534-535 7,537-551 7,553-561 7,562-562 6,563-563 7,564-567 6,570-576 6, 577-577 5,580-587 6,588-588 5,590-595 5,596-599 4,600-620 7,622-631 7,633-641 7,644-668 7, 699-699 6,670-673 7,674-681 6,683-693 6,700-701 8,703-708 8,710-711 7,712-714 8,716-722 7, 723-723 8,724-731 7,733-735 7,736-736 6,737-737 7,738-739 6,740-741 7,743-769 7,770-772 8, 773-775 7,776-777 8,778-782 7,783-785 8,786-789 7,790-794 6,795-797 7,798-799 6,800-807 5, 808-811 6,812-816 5,820-831 5,832-834 4,835-835 4,836-837 4,838-838 4,840-847 5,850-850 5, 852-853 5,855-855 5,856-857 6,859-860 5,863-865 5,870-872 6,873-874 5,875-875 6,877-885 6, 889-891 5,893-895 4,897-898 4,900-908 5,910-928 5,930-935 5,936-954 4,955-955 3,956-959 4, 960-960 3,961-966 4,967-969 8,970-972 2,973-974 1,975-977 2,978-978 3,979-979 4,980-985 3, 986-986 2,988-989 3,990-992 4,993-993 3,994-994 4,995-997 7,998-998 6,999-999 5); var zone = 1; var pricesarray = new Array(4.8,4.8,4.8,4.8,4.8,4.8,4.8,4.8,, 4.8,4.8,4.99,5.37,6.67,7.18,7.69,8.3,5.08,5.08,5.81,6.64,8.15,9.35,10.07,11.41, 5.64,5.64,6.6,7.62,9.78,11.29,12.29,14.03,6.33,6.33,7.58,8.55,11.56,12.98,14.43,16.37,6.98,6.98,8.6,9.84,13.34,14.64,16.62,18.71, 7.68,7.68,9.58,11.14,15.23,16.34,18.76,21.04,8.14,8.14,9.95,12.24,16.7,17.76,20.61,23.63,8.37,8.37,10.64,13.04,18,19.18,22.41,26.3, 9.05,9.05,11.49,14.16,19.5,21.26,24.59,28.59,9.76,9.76,12.37,15.33,21.05,23.38,26.78,30.93,10.36,10.36,13.2,16.45,22.56,25.45,28.96,33.22, 10.64,10.64,13.53,16.92,23.78,27.3,30.11,34.36,11.01,11.01,14.14,17.67,24.86,28.82,31.81,36.08,11.47,11.47,14.74,18.55,25.61,29.43,32.14,36.85, 11.84,11.84,15.26,19.12,26.17,30.08,32.86,37.76,12.25,12.25,15.77,19.49,26.78,30.89,33.72,38.75,12.49,12.49,16.27,19.91,27.35,31.51,34.33,39.66, 12.9,12.9,16.65,20.2,28.01,32.26,35.23,40.66,13.23,13.23,16.87,20.57,28.47,32.88,35.9,41.58,13.6,13.6,17.11,20.89,28.94,33.4,36.51,42.38, 13.92,13.92,17.43,21.22,29.6,34.14,37.37,43.44,14.24,14.24,17.67,21.82,30.12,34.76,37.99,44.2,14.57,14.57,17.86,22.48,30.73,35.47,38.89,45.3, 14.89,14.89,18.13,23.23,31.25,35.99,39.45,46.06,15.21,15.21,18.32,23.97,31.91,36.84,40.31,47.53,15.63,15.63,18.6,24.68,32.33,37.36,40.88,49.31, 16.1,16.1,18.82,25.33,32.76,37.88,41.5,51.12,16.61,16.61,19.01,26.09,33.18,38.35,42.07,52.74,17.11,17.11,19.3,26.78,33.64,38.87,42.64,54.5, 17.58,17.58,19.48,27.53,34.07,39.39,43.21,56.31,18.04,18.04,19.94,28.24,34.49,39.92,44.25,58.09,18.27,18.27,20.46,28.88,34.92,40.44,45.48,59.75, 18.45,18.45,21.01,29.39,35.66,41.62,46.72,61.52,18.68,18.68,21.52,29.81,36.42,42.75,48,63.29,18.87,18.87,22.08,30.19,37.22,43.83,49.28,65.06, 19.05,19.05,22.54,30.62,37.92,44.97,50.57,66.82,19.24,19.24,23.1,30.99,38.67,46.25,51.75,68.53,19.47,19.47,23.58,31.36,39.47,47.38,53.09,70.36, 19.84,19.84,24.08,31.69,40.27,48.46,54.27,72.02,20.25,20.25,24.54,32.06,40.64,49.6,55.6,73.41,20.63,20.63,25.02,32.39,41.49,50.68,56.89,74.41, 21.04,21.04,25.43,32.72,42.43,51.91,58.16,75.37,21.41,21.41,25.95,33.05,43.37,52.99,59.44,76.27,21.78,21.78,26.41,33.38,44.31,54.18,60.73,77.17, 22.19,22.19,26.73,33.7,45.15,55.31,61.96,78.04,22.57,22.57,26.91,33.98,46.15,56.54,63.29,78.94,22.98,22.98,27.15,34.31,47.08,57.67,64.57,79.76,
[jQuery] Re: Cascade (chained) works in Firefox but not in IE
@james, There is not a fixed schema for items in cascade. The json structure is outside the scope of cascade. For smaller lists I might load some javascript when the page hits and assign the 'url' as the var I gave it. For larger lists or more complex objects I might just have an ajax call for each list change event. It just depends. In either case, you are simply dealing with individual items that simply need to answer the predicate found in your 'match' option implementation as to whether they should be hydrated into the child list or not. Hope this helps mike Hey Mike...James here again. Now that I've worked through some of the basics, I would like to know how easy it would be to accommodate a JSON file in a bit of a more efficient structure using arrays rather than a simple value pairs. IE.: You have designed around this structure: {'when':'selectedValue','value':'itemValue','text':'itemText'} Whereas after some testing, I've realized the data sizes would become rather huge rather quickly. I'm proposing a JSON structure such as: { Country1: [ { Region1: [ City1, City2, City3 ], Region2: [ City1, City2, City3 ] } ] } The idea would be for a separate JSON file for each country (now that we've got dynamic URLs working). Of course this simplified structure would require some parsing and reformatting to fit the structure you have used for the .CASCADE plugin. My problem is, since I'm so new to all this, I have no idea where in the code to begin looking at how to take my imported JSON file, and then do the work on it to change it into your format. Could you offer some insight on this? Thanks, James On Feb 2, 8:53 am, James james.tilb...@gmail.com wrote: @kelly Only then I would have to find a way to add some htmlEntitites decoding to the whole thing since I am accessing filenames directly... On Feb 2, 7:33 am, kellyjandr...@sbcglobal.net kellyjandr...@sbcglobal.net wrote: You may have to write the special characters with their HTML equivalent code. Is that not a possibility? On Feb 1, 6:04 pm, James james.tilb...@gmail.com wrote: I did attach firebug at one point but couldn't glean anything useful from it. From my google research, the problem has to do with the encoding (UTF-8) and JQuery's handling of special characters. I can't explain why IE breaks while Firefox just displays a strange character... In any case, the solution to this is beyond me. For now it looks like I'm going to have to run my data through a function to replace accented characters with their normal counterparts. I'd be interested to hear from others about possible fixes to this though... On Feb 1, 4:13 pm, Mike Nichols nichols.mik...@gmail.com wrote: have you attached fiddler and firebug to see what it happening? On Feb 1, 10:14 am, James james.tilb...@gmail.com wrote: ...I must add and point out that the EXACT SAME DATA exists in the external file and the inline var. So it is ALSO very strange that the accents as mentioned display correctly in the first example (pulling from the inline var) and don't in the second example (pulling from the external file). I guess this helps to isolate where the problem is occuring? Some parsing routine that only applies to externally-read files? On Feb 1, 12:10 pm, James james.tilb...@gmail.com wrote: Update2: The problematic page is still up as promised for discussion purposes, but I have a breakthrough to report. I never would have suspected this in a million years, but I discovered it after following through with my same line of logic regarding the JSON data causing a problem. I eliminated single quotes and commas from the equation as these worked just fine. However, I thought I would try other characters since I noticed that accented characters were showing up strangely in the dropdown list (see under Quebec - Gaspé, for an example). Where it should say GASPé, it instead shows GASP(question mark inside a diamond). Firefox displays this, IE doesn't display anything but the loading circle graphic. I can fix this by replacing all accented characters in my data with regular alphabet characters, but the question is - why is this causing a problem with the JQuery/IE combination? I would much rather leave accented characters intact. Something in the JQuery routines can't handle these characters and/or is replacing them with a strange character. Any ideas? On Feb 1, 11:46 am, James james.tilb...@gmail.com wrote: Update: It doesn't seem to have anything to do with single quotes or commas, for that matter,
[jQuery] Re: Math.ceil rounds down instead of up!?
Using decrement the way I did will change the actual var at the same time? It needs to be decremented to pull the correct array value since arrays start at [0] instead of [1] Is there a way to get the decremented value without changing the actual variable? I still need to display the total weight on the page.
[jQuery] Re: Detecting wether an image link is going to work
You can set a timeout and jump to the next image if the image was not loaded before the timeout. see: http://jsbin.com/evitu/edit The third image is a broken link and will run into a 5s timeout. by(e) Stephan 2009/2/3 daveJay davidjo...@exit42design.com: I've got a page set up where it loads each image on the page, one after the other. As you can see here: http://sandbox.exit42design.com/photography/folio_1.html The problem with this is that if one of the images is broken, it'll stop in it's tracks and not try to load the next. Here's an example of how I'm loading the images $(image[1]).load(function(){ $(#image1).attr({src : image[1].src}); image[2].src= path/to/next/image.jpg; }); $(image[2]).load(function(){ $(#image2).attr({src : image[2].src}); image[3].src= path/to/next/image3.jpg; }); So, basically when the first one is loaded, it inserts it onto the page, and then sets up the next image path, and so on and so on. So I need a way to detect if image 2 is going to load successfully, because if it can't image 3 will never be allowed to load. I tried using an ajax call but I'm not terribly familiar with how to use it, for example, in an if statement. Can I get this ajax call to just return a yes or no value of wether or not there was an error or not? $.ajax({url:imagesSrc[1], type:'HEAD', error:somefunction}) Thanks for any help. And any other comments/bug reports on the site are welcome as well =)
[jQuery] Re: Math.ceil rounds down instead of up!?
On Tue, Feb 3, 2009 at 2:28 PM, Zaliek zali...@gmail.com wrote: Using decrement the way I did will change the actual var at the same time? It needs to be decremented to pull the correct array value since arrays start at [0] instead of [1] Is there a way to get the decremented value without changing the actual variable? I still need to display the total weight on the page. weightpricearray = (pricesarray[totalweight - 1]).split(,);
[jQuery] Re: Performance suggestion: Use object hash instead of regexp
I imagine a switch is the same speed as a hash (switches generally evaluate to a hash). Using a trie structure could be faster than regex in some circumstances I imagine: http://en.wikipedia.org/wiki/Trie On Feb 3, 12:45 pm, Eric Garside gars...@gmail.com wrote: In that case, wouldn't a switch statement have even less overhead than creating an object to check everytime? I'd think switch(tag){case 'body':case 'html': /* ... */ break;} would be an even faster solution, no? On Feb 3, 12:39 pm, George Adamson george.adam...@softwareunity.com wrote: Absolutely, it is very very limited. So this technique is only suited to the type of regex's that I quoted, like the one used internally by jquery to test for body or html tags only, or to test for t(able|d|h) only. Particulalry when used inside a loop. For parsing a selector we still need regex. On Feb 3, 3:16 pm, Eric Garside gars...@gmail.com wrote: Using a hash I can see for some situations, but unless you can figure out a way (and I'd be super interested if you could) to do complex cascade parsing without regex, your method seems like double the work of rewriting with no benefits towards maintainability and a minor speed increase for only certain tags.- Hide quoted text - - Show quoted text -
[jQuery] Re: Help creating a function
Change $('form').submit(function(){ to $('input.counter').change(function(){ This will prompt the check to run each time the user changes a value in any of the concerned fields. On Feb 3, 1:18 pm, ebru...@gmail.com ebru...@gmail.com wrote: I get it now. I didn't add a submit button. Do you now if it's also possible to use it without pressing on the submit so it would be a realtime check. On 3 feb, 19:08, Eric Garside gars...@gmail.com wrote: Ah, I'm pretty sure i missed wrapping the loop's this in a jQuery obj Try replacing this line: num += this.val()*1; with num += $(this).val()*1; Also, do an alert before and after the loop and just see what the values are: alert('Limit: ' + lim + \nNum: + num); On Feb 3, 12:58 pm, ebru...@gmail.com ebru...@gmail.com wrote: Looking good Eric, i tied it out, but it doenst seem to work. I already fixed the bug in the alert with the ' in it, but no reponse when filling in alot of numbers. On 3 feb, 17:48, Eric Garside gars...@gmail.com wrote: Sorry for that last post, wrong thread. :( Anyway, you could try something like this: form input id=lim type=hidden value=40/ input id=input_1 type=text class=counter/ input id=input_2 type=text class=counter/ input id=input_3 type=text class=counter/ input id=input_4 type=text class=counter/ input id=input_5 type=text class=counter/ input id=input_6 type=text class=counter/ /form $(function(){ $('form').submit(function(){ var num = 0, lim = $('#lim').val()*1; $('input.counter').each(function(){ num += this.val()*1; }); if (num lim){ alert('You can't take more than ' + lim + ' bags, but you have selected ' + num + ' bags!'); return false; } }); }); On Feb 3, 11:33 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Erwin, Of course you can code it by hand, but I would suggest that you take a look at the various validation plugins for jQuery (e.g.http://plugins.jquery.com/project/validate) first. by(e) Stephan 2009/2/3 ebru...@gmail.com ebru...@gmail.com: Hello, I have a site where i want to run a realtime check. I have 6 form fields, when someone fills a number in jquery has to check if he doesn't go over the max what he can fill in. So for example he kan take 40 bags: Field one he fills in 10 Field two he fills in 10 Field three he fills in 10 Field four he fills in 10 Field five he fills in 10 Field six he fills in 10 He wants to take 60 bags thats over the max he can take so there has to show a messages on the website: You can't take more then 40 bags you have selected 60 bags now! If he takes 40 bags the only thing there has to showup is how much he has filled in total. Any one how can advise me on how to fix this. Erwin- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -