[jQuery] How can I display loader images on different locations for different ajax requests using ajaxStart
Hi, Please tell me how to display loader images on different locations for different ajax requests using ajaxStart. I have posted my code at the link below : http://groups.google.com/group/jquery-en/browse_thread/thread/8e1967f057e3e251/d5cc973ecac2ddf7?lnk=gstq=Problem+for+calling+ajaxStart+and+ajaxStop#d5cc973ecac2ddf7 Thanks.
[jQuery] jQuery.get filtered JavaScript Tag
When using jQuery.get to fetch remote contents, the content inside the script tag will be removed and therefore not executed. Is it possible to incluce the script tag and run it automcatically when using jQuery.get ? Thanks.
[jQuery] Re: jQuery nodes traversing
Hi, Thanks for helping. I think I haven't explained properly what I wanted I'm looking for the first parent with an attribute 'id', which in this example was div id=main. However it could be anything, not necessary main, so your code wouldn't work as you are looking specifically for #main. I think your .each() function is correct, however I can't test right now, but will give it a go. Thanks for that. :) On 19 Dec, 21:33, Ricardo Tomasi ricardob...@gmail.com wrote: To get the #main parent you'd use $('h2').parents('#main') You can get indexes for all parents in 'inside out' order, or use the index() function to calculate them: $('h2').parents().each(function(index){ // p index == 0 // div index == 1 // #main index == 2 $(this).parent().children().index(this); //should give you the indexes you want (p==2,div==0) }); Hope you get the idea. Check the documentation (docs.jquery.com/ Selectors, docs.jquery.com/Traversing) in case of doubt :) - ricardo On Dec 19, 2:13 pm, graphic...@googlemail.com graphic...@googlemail.com wrote: Hi, Consider the following html : div id=main div p/ p/ p h2 target node /h2 /p /div /div Starting from the h2 node, I want to find its closest parent with an id, in this case the div with id=main. I also want to store the index position of all of the parents of the target. In this case that would be 0 (for the div right under main) and 2 (for the third p) How can I do that using jQuery ? I hope what I ask is clear enough.
[jQuery] Re: [validate] Missing the submit button params
As a workaround, you could manually trigger the remote validation, via $(#remotefield).valid(); the plugin caches the input's value, and doesn't validate it again if it isn't changed. If you have only one submit button, you could also add a hidden field that has the name/value of the button. Jörn On Fri, Dec 19, 2008 at 3:01 PM, Jolle jo...@carlestam.com wrote: On 19 Dec, 12:14, Jolle jo...@carlestam.com wrote: I'm using the validator plugin from bassistance.de/jquery-plugins/ jquery-plugin-validation/. Lovely and really powerful! But, my server side logic require the parameters from the submit button used. And it seems as if Validator doesn't include that when submitting the form. The param I need especially is the name of the button. Is this some setting I can make or does it require tweaking of the Validator plugin? Doing som testing shows that it's the remote validation that trips Validator. In the form I have a field that's already populated with a value and that field is set to use remote validation. If the field is unchanged and I submit the form then the name and value for the submit button is not sent. If I change the value of the field before submit and thus trigger the remote validation then the form is submitted without issue. There's a test page here if anyone's interested: http://cojan.se/validatetest.lasso HDB Jolle
[jQuery] Re: validation plugin negative number rule?
Use min: 0. Jörn On Fri, Dec 19, 2008 at 8:02 PM, Adam apcau...@gmail.com wrote: How can I create a rule in the validation plugin to disallow negative numbers. I have a text field that should accept any number 0 thanks, A.
[jQuery] Re: [validate] Missing the submit button params
On 20 Dec, 11:35, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: As a workaround, you could manually trigger the remote validation, via $(#remotefield).valid(); the plugin caches the input's value, and doesn't validate it again if it isn't changed. Yes, this seems to work. Thanks! If you have only one submit button, you could also add a hidden field that has the name/value of the button. Na, that's the problem. I have several submit buttons. One for save, one for delete etc. That's why I have to know what button that was used when submitting. HDB Jolle
[jQuery] Re: create a translate plugin using jQuery
tkx for your answer, no i want to create a plugin using jquery i need't a google's machine to translate so i want a different steps to create plugin to translate and when i install or add my plugin, automatiqquely a my site web translate in frensh ok tkx for your help Merci beaucoup Rabab 2008/12/19, Balazs Endresz balazs.endr...@gmail.com: If you have the translation: http://recurser.com/articles/2008/02/21/jquery-i18n-translation-plugin/ Alternatively, if you want to use Google's machine translation: http://code.google.com/p/jquery-translate/ On Dec 19, 10:33 am, Rabab CHAKHMOUNE rabab.chakhmo...@gmail.com wrote: Hello I want to create a plugin to translate a site web (translate english to french) and i don't know what i need for begin my project to create this plugin. any one here can help me? tkx sorry for my english because i speak frensh Rabab -- SIMPLICITY OR COMPLEXITY IS NOT THE QUESTION
[jQuery] Error on validation plugin documentation?
Hi, I'm tryng for the first time the validation plugin, I was looking at the doc here: http://docs.jquery.com/Plugins/Validation/validate In the "invalidHandler" sample code there is: $(".selector").validate({ invalidHandler: function(form) { var errors = validator.numberOfInvalids(); This gave me an error (validator is not defined), and reading the explanation above this code there is: Callback for custom code when an invalid form is submitted. Called with a event object as the first argument, and the validator as the second. Then I changed the code in : $(".selector").validate({ invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); and now it works. I have an account on the jquery site, but before editing some code I don't know, I ask here if my suggestion is right... Bye -- gianiaz.net - web solutions via angelo custode, 10 - 23100 sondrio (so) - italy +39 347 7196482
[jQuery] jscrollpane _ how to remove flicker on initialisation ?
hello! You can view the problem i'm trying to solve here: http://www.lab-au.com/mr_news/ The OS scrollbars appears for a fraction of second until jscrollpane gets rendered. Did anybody came up with a good solution to avoid the display of default browser scrollbars when jscrollpane kicks in? (Mike?) thanks mates ! Alexandre
[jQuery] [Validate] Validator plugin working (kind of) but submitting form!?
Hello, Im using the validator plugin in Rails, which is fantastic, but noticed something odd the other day. The form actually appears to be SUBMITTING, even if the validation fails!? I can't imagine this is supposed to happen. I was under the impression that the plugin is supposed to prevent the form from submitting if the form is invalid but sure enough, it is submitting and I have to double validate in Rails. Any idea what could cause this? I'm basically using a modified version of the Remember the Milk demo in rails in a Facebox div. code $(document).ready(function() { var options = { success: showResponse }; $('#facebox #join_form').livequery(function() { $(this).ajaxForm(options); // validate signup form on keyup and submit var validator = $(this).validate({ rules: { 'user[name]': required, 'user[nickname]': { required: true, minlength: 2, remote: /user/remote_handler }, 'user[password]': { required: true, minlength: 5 }, 'password_confirm[]': { required: true, minlength: 5, equalTo: #facebox #user_password }, 'user[email]': { required: true, email: true, remote: /user/remote_handler } }, messages: { 'user[name]': Enter your firstname, 'user[nickname]': { required: Enter a username, minlength: jQuery.format(Enter at least {0} characters), remote: jQuery.format({0} is already in use) }, 'user[password]': { required: Provide a password, rangelength: jQuery.format(Enter at least {0} characters) }, 'password_confirm[]': { required: Repeat your password, minlength: jQuery.format(Enter at least {0} characters), equalTo: Enter the same password as above }, 'user[email]': { required: Please enter a valid email address, minlength: Please enter a valid email address, remote: jQuery.format({0} is already in use) } }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent().next() ); }, // specifying a submitHandler prevents the default submit, good for the demo submitHandler: function() { $(this).ajaxSubmit(); // }, // set this class to error-labels to indicate valid fields success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); }, invalidHandler: function() { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed 1 field. It has been highlighted' : 'You missed ' + errors + ' fields. They have been highlighted'; //alert(message); } else { $(div.error).hide(); } } }); }); });/code
[jQuery] Re: Need help to decide on SWF/FLV/SIFR plugin - a bit unsure, for sure!
--- On Fri, 12/19/08, yvonney yvonn...@gmail.com wrote: From: yvonney yvonn...@gmail.com Subject: [jQuery] Need help to decide on SWF/FLV/SIFR plugin - a bit unsure, for sure! To: jQuery (English) jquery-en@googlegroups.com Date: Friday, December 19, 2008, 8:43 PM Hi all! [OBJECTIVE: need best solution to have flash (and perhaps likely .flv as well) and also SIFR stuff work] Hoping to have a plugin guru advise as to whether 2 plugins whould be advised, or one, and which one(s) ??? Here's what I've thought. 1) There's a couple or a few flash/flv type JQery plugins, all very cool one of them (or more) do SIFR as well. 2) I would like to AVOID using JW flash player and that other popular one so I've thought that having flash SWFs and not FLVs might be needed. Not sure. I DO need to have a play and stop button at least. Would this mean I HAVE to custom create/encode EACH video to a SWF and with player features? I guess so... AND, I'm using LINUX... so...hmm. what would I use?? 3) YES. I'm able to fumble around and try to answer all the questions myself though it would take me at least hours and likey days. And even then I'd probably make at least one decision wrongly. Could anyone help on finding out the MOST elegant/flexible way of having SIFR and SWF or FLV working with JQuery...?? (or standalone? as in using SWFobject 2 ?) - Should I use SWFobject or the one/two of the JQuery plugins? - IS there a, well, ... REAL full open source player anymore that's worth getting good at any more? - If not I'd want to find some way to have SIFR and SWFs (and FLVs?) play and stop on demand. - For SIFR I'm confused still. Is it a good idea to use a PLUGIN that does flash and sifr? Basically I started out thinking geez. JW player and the other one seem to not be for me any more... I wonder if I can easily on linux take my videos (mpeg etc.) and create flash SWFs or FLVs that don't need a player. Must have stop and start feature though, and hopefully volume control. And of course, I'm in love with my Linux box though not experienced with transcoding/ flash etc.um, yet! :--) ANY help greatly much appreciated of course. Thing is, I KNOW there IS a best way. one plug? two plugs? which? flv or custom swf? and then... what to do on linux? much thanks goes here, for yur reading of this! how cool is 2008 -
[jQuery] Simple XPATH Selector
Hi, I am trying XPATH selector with jqueryit doesn't seem to work..find below the eg.it should select the paragraph. can any tell me what I am missing. THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .jq{ background-color:red; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $(//p).addClass(jq) }) /script /head body h1heading/h1 pparagraph/p /body /html
[jQuery] :not selector --- not working
Hi, I tried a eg for :not operator.According to which it should not pick up the Table header but it does .what am i missing. One more question what is the significance of putting the 'th' in the square bracket .is it OK to write like this. $('tr:not(th):even').addClass('even'); THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .even{ background-color:blue; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $('tr:not([th]):even').addClass('even'); }) /script /head body table tr thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td/tr tr tdAll's Well that Ends Well/td tdComedy/td/tr tr tdHamlet/td tdTragedy/td/tr tr tdMacbeth/td tdTragedy/td/tr tr tdRomeo and Juliet/td tdTragedy/td/tr tr tdHenry IV, Part I/td tdHistory/td/tr tr tdHenry V/td tdHistory/td/tr /table /body /html
[jQuery] Problem with reloading AJAX content (Flowplayer) in jqModal window
Hi, I'm a relative newcomer to jQuery (and Javascript in general), and I'm having a problem with content loaded via AJAX that I gather is related to event delegation/rebinding. I'm using jqModal to populate a modal window with html content via AJAX. The content contains both text and a Flowplayer instance (open source .flv player). The first time I open the modal window, both the text and the Flowplayer movie load properly via AJAX. But each subsequent time I open the modal window, only the text appears. Here is the code for the original page (default.php): body a href=# class=jqModalClick here for AJAX!/a div id=wrapper div id=ajax class=jqmWindow a id=player class=flowplayer/a /div !-- end #ajax -- /div /body Here is the content loaded via AJAX (ajax.php): a href=# class=jqmCloseClose/a br / h2 class=centeredAJAX works!/h2 a id=player /a Here is the jQuery script: var loadFlowplayer = function() { $(#player).flowplayer(/swf/flowplayer-3.0.2.swf, { clip: { url: '/video/test.flv', autoPlay: false } }); } $(document).ready(function() { $('#ajax').jqm({ajax: '/ajax.php', onLoad: loadFlowplayer}; }); After reading through the jQuery board for similar topics, I tried removing the Flowplayer portion of the jQuery script (and deleting the jqModal onLoad callback) and appending it directly to ajax.php, like so: a href=# class=jqmCloseClose/a br / h2 class=centeredAJAX works!/h2 a id=player/a script type=text/javascript charset=utf-8 $('#player').flowplayer('/swf/flowplayer-3.0.2.swf', { clip: { url: '/video/test.flv', autoPlay: false } }); /script The result was the same -- both movie player and text load fine after the first AJAX call, each subsequent time only the text loads. I thought that by either calling flowplayer() as a callback to the AJAX request in the external script or by including it inline in script tags with the remote content that I was rebinding the event to the jQuery selector, but it seems I'm mistaken. Any help would be much appreciated. Cheers, Jeff
[jQuery] Re: Simple XPATH Selector
jQuery doesn't support XPath selectors any more - you need to use CSS selectors. $(p).addClass(jq); --John On Dec 20, 9:36 am, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying XPATH selector with jqueryit doesn't seem to work..find below the eg.it should select the paragraph. can any tell me what I am missing. THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .jq{ background-color:red; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $(//p).addClass(jq) }) /script /head body h1heading/h1 pparagraph/p /body /html
[jQuery] Re: :not selector --- not working
That's an XPath selector, not a CSS selector. To do that in jQuery you would need to do: $(tr:not(:has(th)):even) --John On Dec 20, 9:38 am, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I tried a eg for :not operator.According to which it should not pick up the Table header but it does .what am i missing. One more question what is the significance of putting the 'th' in the square bracket .is it OK to write like this. $('tr:not(th):even').addClass('even'); THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .even{ background-color:blue; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $('tr:not([th]):even').addClass('even'); }) /script /head body table tr thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td/tr tr tdAll's Well that Ends Well/td tdComedy/td/tr tr tdHamlet/td tdTragedy/td/tr tr tdMacbeth/td tdTragedy/td/tr tr tdRomeo and Juliet/td tdTragedy/td/tr tr tdHenry IV, Part I/td tdHistory/td/tr tr tdHenry V/td tdHistory/td/tr /table /body /html
[jQuery] thickbox close and ajax request
Hi! I've small (or big- I'm unaware...). I made small image manager using thickbox, when I'm adding new article I can add some images (open thickbox, upload image) AND AFTER CLOSING THICKBOX image list should refresh (using ajax), the main problem is sending request after closing the thickbox (IFRAME!) i tried: $(#TB_closeWindowButton, top.document).click(function() { $.post(/n/admin/news/photos, { id: 5801 } ); }); but it doesn't work properly thanks in advance for help
[jQuery] cycle problems
Hi, I can't get jQuery cycle to work and I have no idea why, so I would really appreciate some help. my code: HTML ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//SV http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=sv dir=ltr lang=sv html head titleCYCLE/title style type=text/css media=all @import url(css/cycle.css);/style script type=text/javascript src=jquery-1.2.6.js/script script type=text/javascript src=jquery.cycle.all.pack/script script type=text/javascript $(document).ready(function(){ $('#s1').cycle({ fx: 'scrollDown' }); }); /script /head body div id=wrapper div id=s1 class=cycle img src=images/1.jpg/ img src=images/2.jpg/ img src=images/3.jpg/ img src=images/4.jpg/ /div /div /body /html CSS #cycle { height: 253px; width: 503px; padding: 0; margin: 0; } #cycle img { padding: 15px; border: 1px solid #ccc; background-color: #eee; width: 500px; height: 250px; top: 0; left: 0 } As you can see, it's extremely basic, since I'm just testing the plugin. But why why can't I get it to work.. Also I get this error message in firebug: $(#s1).cycle is not a function (no name)()cycle.html (line 16) to the wait list jQuery.readyList.push()jquery-1.2.6.js (line 2294) (no name)()jquery-1.2.6.js (line 2314) each([function()], function(), undefined)jquery-1.2.6.js (line 745) ready()jquery-1.2.6.js (line 2313) [Break on this error] fx: 'scrollDown' Thanks in advance for any help.
[jQuery] show form after each slide (islideshow.js)
Hi everyone, I'm new to JS and jQuery, and have been searching my off to find a solution for the following problem: I'm using jQuery with the Interface elements plug ins to display a slide show (islideshow.js). The photos are held in a PHP array and are being dynamically fed to the slide show. This is the easiest part: the slide show displays all the images perfectly. What i am trying to do now is to have a form with three submit type buttons displayed after each image in the slide show for the duration of 10 seconds, where the visitor can select one of the buttons (preferably by keystroke). After this 10 second period the slide show continues with the next image, followed by the form etc. At the end of the slide show the collected form data should be sent out (by e-mail). Can anyone point me into the right direction as to how to achieve this with jQuery / interface.js? Is this feasible at all? Any help would be much appreciated! Cheers, Mark -- View this message in context: http://www.nabble.com/show-form-after-each-slide-%28islideshow.js%29-tp21105738s27240p21105738.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: cycle problems
Hi, I can't get jQuery cycle to work and I have no idea why, so I would really appreciate some help. my code: HTML ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//SV http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=sv dir=ltr lang=sv html head titleCYCLE/title style type=text/css media=all @import url(css/cycle.css);/style script type=text/javascript src=jquery-1.2.6.js/script script type=text/javascript src=jquery.cycle.all.pack/script script type=text/javascript $(document).ready(function(){ $('#s1').cycle({ fx: 'scrollDown' }); }); /script /head body div id=wrapper div id=s1 class=cycle img src=images/1.jpg/ img src=images/2.jpg/ img src=images/3.jpg/ img src=images/4.jpg/ /div /div /body /html CSS #cycle { height: 253px; width: 503px; padding: 0; margin: 0; } #cycle img { padding: 15px; border: 1px solid #ccc; background-color: #eee; width: 500px; height: 250px; top: 0; left: 0 } As you can see, it's extremely basic, since I'm just testing the plugin. But why why can't I get it to work.. Also I get this error message in firebug: $(#s1).cycle is not a function (no name)()cycle.html (line 16) to the wait list jQuery.readyList.push()jquery-1.2.6.js (line 2294) (no name)()jquery-1.2.6.js (line 2314) each([function()], function(), undefined)jquery-1.2.6.js (line 745) ready()jquery-1.2.6.js (line 2313) [Break on this error] fx: 'scrollDown' Thanks in advance for any help. Looks like you're missing the file extension for the Cycle plugin in your script tag: script type=text/javascript src=jquery.cycle.all.pack/script Also, your css rules don't make sense because your document does not have any element with the ID of cycle. I think you meant to make rules for either #s1 or .cycle. Mike
[jQuery] How to parse variables in url to modal box?
How would I parse my variables in a link like... a href=index.php?var1=valuevar2=value rel=modalboxshow modalbox/a ... to a modal box, like the build-in dialog in jQuery? I've tried to solve the problem in the code below, but it does not work for 2 reasons: 1 ) I cannot put in variables using eval (see the line $.get (anchor...) 2 ) If theres more than one link on the page with the rel-attribute things gets messed up. The modalbox just shows the first link found on the page not the one that actually has been clicked. I really don't want to use onclick... if there's another way. script type=text/javascript $(document).ready(function(){ $(body).append(div id='modalwindow'/div); var anchor = $('a...@rel*=modalbox]'); var url = anchor.attr(href); var file = url.substring(0, url.indexOf(?)); var vars = getVarsFromURL(url); anchor.click(function() { $(#modalwindow).dialog({ modal: true, resizable: false, draggable: true, width:600, height:600, overlay: { opacity: 0.5, background: black } }); $.get(anchor.attr(href), { eval(vars) }, function(data){ $(#modalwindow).html(data); }); return false; }); }); // eval(getVarsFromURL(link.attr(href))) function getVarsFromURL(url) { var queryStr = url.substring(url.indexOf(?)+1); var strRes = ; var pairs = queryStr.split(); for (var i in pairs) { var pair = pairs[i].split(=); strRes += pair[0] + :' + pair[1] + ',; } return strRes.substring(0, strRes.length-1); } /script
[jQuery] Re: problem with :contains in 'td'
Also I am not sure what is being passed in the filter .I assume it to be the TD element right now can somebody correct me or tell me what is happening.I want the 'History' cells to be red THnks On Dec 20, 1:43 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying to match the content in 'td' and think the problem is with contains when it is trying to query withing 'td' $(:contains('Comedy'),'td').css(background- color,green); doesn't work... but if I tried... $(:contains('Comedy'),'tr').css(background- color,green); this WORKS WHY http://chinnakaruppan.googlepages.com/index.html Please find below the full code... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content= HTML Tidy, seewww.w3.org / meta http-equiv=Content-Type content= text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' /style script type=text/javascript src=/lib/jquery/jquery.js /script script type=text/javascript $(document).ready(function(){ $('tr td').filter(function(){ return $(':contains(History)',this); }).css(background-color,red); $(td:contains('Tragedy')).css(background-color,blue); $('tr td').filter(:contains('Comedy')).css(background- color,green); }) /script /head body table tr class=header thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td /tr tr tdAll's Well that Ends Well/td tdComedy/td /tr tr tdHamlet/td tdTragedy/td /tr tr tdMacbeth/td tdTragedy/td /tr tr tdRomeo and Juliet/td tdTragedy/td /tr tr tdHenry IV, Part I/td tdHistory/td /tr tr tdHenry V/td tdHistory/td /tr /table /body /html
[jQuery] Re: problem with :contains in 'td'
Or rather the question should be can the :contains selector have a context for its search..and if I make the 'this' to be it will it work. On Dec 20, 1:43 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying to match the content in 'td' and think the problem is with contains when it is trying to query withing 'td' $(:contains('Comedy'),'td').css(background- color,green); doesn't work... but if I tried... $(:contains('Comedy'),'tr').css(background- color,green); this WORKS WHY http://chinnakaruppan.googlepages.com/index.html Please find below the full code... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content= HTML Tidy, seewww.w3.org / meta http-equiv=Content-Type content= text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' /style script type=text/javascript src=/lib/jquery/jquery.js /script script type=text/javascript $(document).ready(function(){ $('tr td').filter(function(){ return $(':contains(History)',this); }).css(background-color,red); $(td:contains('Tragedy')).css(background-color,blue); $('tr td').filter(:contains('Comedy')).css(background- color,green); }) /script /head body table tr class=header thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td /tr tr tdAll's Well that Ends Well/td tdComedy/td /tr tr tdHamlet/td tdTragedy/td /tr tr tdMacbeth/td tdTragedy/td /tr tr tdRomeo and Juliet/td tdTragedy/td /tr tr tdHenry IV, Part I/td tdHistory/td /tr tr tdHenry V/td tdHistory/td /tr /table /body /html
[jQuery] Re: Cluetip speed question
On Tue, Dec 16, 2008 at 6:26 PM, Michael Geary m...@mg.to wrote: http://osdir.com/answers/javascript/2618-jquery-optimizing-easiest-tooltip.html#2 Maybe you could use this code as a start for a custom tooltip plugin? Thanks for that link, I did manage to modify the simpletip.js library mentioned later down, and now the javascript portion of the page is 10ms in time. :) I couldn't find an email to thank the author in that, but here is the changeset with my modified version of the file for anyone else who may be interested: https://www.maiamailguard.com/maia/changeset/1367 -- David Morton morto...@gmail.com - bulk address morto...@dgrmm.net - direct to my server
[jQuery] [treeview] Expand on link click
It looked like a link clicked would expand it AND the link would load. But I've found that if the link is another page, there is some event timing problem where it tries to open but then the new page loads and the expand is lost. You can see it here, zunga.orgfree.com Note that the + and - still expand, but I want the whole link to do the expanding. thanks!!
[jQuery] [Validate] What is causing this error?
I'm making another attempt to get Jorn's validation plug-in working. I'm getting this error from Firebug after clicking in the first required field then out (onfocusout): validator.settings[on + event.type].call is not a function (function($) {$.extend($.fn,{validate:fun...cured when checking element +element.id Here's the code...where's my error? (I'd love to show you an online example, but this is part of an Intranet app...) Any help appreciated! $(document).ready(function() { $('#add-rental-property-form').validate({ errorPlacement: function(error, element) { if(element.attr('id') == 'street_number') { error.appendTo('#street-number-error'); } else if(element.attr('id') == 'street_name') { error.appendTo('#street-name-error'); } else if(element.attr('id') == 'city') { error.appendTo('#city-error'); } }, onsubmit: false, onfocusout: true, rules:{ street_number: required, street_name:required, city: required }, messages: { street_number: required: Please enter the property street number., street_name:required: Please enter the street name., city: required: Please enter the Years. }, }) });
[jQuery] How to fade in next div after previous div faded in upon document.ready ?
Hi all ! I tried but did not succeeded in making this work. To explain what I'm trying to do. HTML: body div id=first_divptext/p/div div id=second_divptext/p/div div id=third_divptext/p/div /body CSS not important right now jQuery: on document.ready function collect all divs witch id ends with _div first make them all hidden with .hide() then show them one by one using .fadeIn() but next div fades in after previous finished fading in I got the first part: $(function() { $('d...@id$=_div]').hide(); }); but how to loop through $('d...@id$=_div]') and make divs fade in sequentially ? $('d...@id$=_div]').each(function() { $(this).fadeIn('slow'); }); this makes all divs to fade in at the same time what now ? thanks in advance
[jQuery] Google Reader style endless scroll library?
Hey y'all. I'd like to provide endless scrolling of search results in the manner of Google Reader. The thing where an AJAX call loads more results when you scroll to the bottom of the list of results. A Google search turned up a lot of articles on the theory of how to do it. I also searched the jQuery plugin repository. Is there a reliable library or jQuery plugin that provides this functionality? If not I'll roll my own. Just thought I'd check first. Thanks, Ethan
[jQuery] How to fade in next div after previous div faded in upon document.ready ?
Hi all ! Here is my question: How to fade in div after the previous div finished fading in ? Here is code I have so far: HTML: div id=header_div p id=header_textHeader text/p /div div id=body_div p id=body_textBody text/p /div div id=footer_div p id=footer_textFooter text/p /div CSS: not important here jQuery: $(function() { $('d...@id$=_div]').hide(); $('d...@id$=_div]').each(function() { $(this).fadeIn('slow'); }); }); To explain the code: when DOM is ready we select all divs witch id is ending with _div than we hide them with .hide() than we loop through each of them with .each() and make them fade in with .fadeIn() now this code fade in all divs at the same time how to fade in them one after another sequentially ? thanks in advance crowebster
[jQuery] Re: jQuery nodes traversing
$('h2').parents('[id]') should work! On Dec 20, 8:17 am, graphic...@googlemail.com graphic...@googlemail.com wrote: Hi, Thanks for helping. I think I haven't explained properly what I wanted I'm looking for the first parent with an attribute 'id', which in this example was div id=main. However it could be anything, not necessary main, so your code wouldn't work as you are looking specifically for #main. I think your .each() function is correct, however I can't test right now, but will give it a go. Thanks for that. :) On 19 Dec, 21:33, Ricardo Tomasi ricardob...@gmail.com wrote: To get the #main parent you'd use $('h2').parents('#main') You can get indexes for all parents in 'inside out' order, or use the index() function to calculate them: $('h2').parents().each(function(index){ // p index == 0 // div index == 1 // #main index == 2 $(this).parent().children().index(this); //should give you the indexes you want (p==2,div==0) }); Hope you get the idea. Check the documentation (docs.jquery.com/ Selectors, docs.jquery.com/Traversing) in case of doubt :) - ricardo On Dec 19, 2:13 pm, graphic...@googlemail.com graphic...@googlemail.com wrote: Hi, Consider the following html : div id=main div p/ p/ p h2 target node /h2 /p /div /div Starting from the h2 node, I want to find its closest parent with an id, in this case the div with id=main. I also want to store the index position of all of the parents of the target. In this case that would be 0 (for the div right under main) and 2 (for the third p) How can I do that using jQuery ? I hope what I ask is clear enough.
[jQuery] Re: problem with :contains in 'td'
$('tr:contains(Comedy)') and $(':contains(Comedy)','tr') are not the same. When using tr as a context, you're searching it's children (the tds). So if you pass td as a context, the search will happen on it's children (which are none in your page). You need $('td:contains(Comedy)') or to exemplify the relationship, $ ('td:contains(Comedy)','tr') - ricardo On Dec 20, 7:04 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Or rather the question should be can the :contains selector have a context for its search..and if I make the 'this' to be it will it work. On Dec 20, 1:43 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying to match the content in 'td' and think the problem is with contains when it is trying to query withing 'td' $(:contains('Comedy'),'td').css(background- color,green); doesn't work... but if I tried... $(:contains('Comedy'),'tr').css(background- color,green); this WORKS WHY http://chinnakaruppan.googlepages.com/index.html Please find below the full code... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content= HTML Tidy, seewww.w3.org / meta http-equiv=Content-Type content= text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' /style script type=text/javascript src=/lib/jquery/jquery.js /script script type=text/javascript $(document).ready(function(){ $('tr td').filter(function(){ return $(':contains(History)',this); }).css(background-color,red); $(td:contains('Tragedy')).css(background-color,blue); $('tr td').filter(:contains('Comedy')).css(background- color,green); }) /script /head body table tr class=header thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td /tr tr tdAll's Well that Ends Well/td tdComedy/td /tr tr tdHamlet/td tdTragedy/td /tr tr tdMacbeth/td tdTragedy/td /tr tr tdRomeo and Juliet/td tdTragedy/td /tr tr tdHenry IV, Part I/td tdHistory/td /tr tr tdHenry V/td tdHistory/td /tr /table /body /html
[jQuery] Re: problem with :contains in 'td'
Thanks a lot ricardo.. $(':contains(History)','tr').css(background-color,red); (WORKS) One thing I understood was :contains uses the context to search in it children.not in the same element.becoz when I use 'td' as the context td has the text 'History' in it that I am looking for. Is this is a right statement??? Also Can you do the same with filter function...Filter passes the 'this' which I assume to be element 'TR' here $('tr ').filter(function(){ return $(':contains(History)',this); }).css(background-color,red); This ends up making all rows red ...What is it I am not seeing THanks once again... ricardobeat wrote: $('tr:contains(Comedy)') and $(':contains(Comedy)','tr') are not the same. When using tr as a context, you're searching it's children (the tds). So if you pass td as a context, the search will happen on it's children (which are none in your page). You need $('td:contains(Comedy)') or to exemplify the relationship, $ ('td:contains(Comedy)','tr') - ricardo On Dec 20, 7:04 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Or rather the question should be can the :contains selector have a context for its search..and if I make the 'this' to be it will it work. On Dec 20, 1:43 pm, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying to match the content in 'td' and think the problem is with contains when it is trying to query withing 'td' $(:contains('Comedy'),'td').css(background- color,green); doesn't work... but if I tried... $(:contains('Comedy'),'tr').css(background- color,green); this WORKS WHY http://chinnakaruppan.googlepages.com/index.html Please find below the full code... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content= HTML Tidy, seewww.w3.org / meta http-equiv=Content-Type content= text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' /style script type=text/javascript src=/lib/jquery/jquery.js /script script type=text/javascript $(document).ready(function(){ $('tr td').filter(function(){ return $(':contains(History)',this); }).css(background-color,red); $(td:contains('Tragedy')).css(background-color,blue); $('tr td').filter(:contains('Comedy')).css(background- color,green); }) /script /head body table tr class=header thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td /tr tr tdAll's Well that Ends Well/td tdComedy/td /tr tr tdHamlet/td tdTragedy/td /tr tr tdMacbeth/td tdTragedy/td /tr tr tdRomeo and Juliet/td tdTragedy/td /tr tr tdHenry IV, Part I/td tdHistory/td /tr tr tdHenry V/td tdHistory/td /tr /table /body /html -- View this message in context: http://www.nabble.com/problem-with-%3Acontains--in-%27td%27-tp21108297s27240p21110837.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery nodes traversing
or $('h2').parents('[id]:first') sorry 'bout the flooding :) On Dec 20, 9:57 pm, Ricardo Tomasi ricardob...@gmail.com wrote: $('h2').parents('[id]') should work! On Dec 20, 8:17 am, graphic...@googlemail.com graphic...@googlemail.com wrote: Hi, Thanks for helping. I think I haven't explained properly what I wanted I'm looking for the first parent with an attribute 'id', which in this example was div id=main. However it could be anything, not necessary main, so your code wouldn't work as you are looking specifically for #main. I think your .each() function is correct, however I can't test right now, but will give it a go. Thanks for that. :) On 19 Dec, 21:33, Ricardo Tomasi ricardob...@gmail.com wrote: To get the #main parent you'd use $('h2').parents('#main') You can get indexes for all parents in 'inside out' order, or use the index() function to calculate them: $('h2').parents().each(function(index){ // p index == 0 // div index == 1 // #main index == 2 $(this).parent().children().index(this); //should give you the indexes you want (p==2,div==0) }); Hope you get the idea. Check the documentation (docs.jquery.com/ Selectors, docs.jquery.com/Traversing) in case of doubt :) - ricardo On Dec 19, 2:13 pm, graphic...@googlemail.com graphic...@googlemail.com wrote: Hi, Consider the following html : div id=main div p/ p/ p h2 target node /h2 /p /div /div Starting from the h2 node, I want to find its closest parent with an id, in this case the div with id=main. I also want to store the index position of all of the parents of the target. In this case that would be 0 (for the div right under main) and 2 (for the third p) How can I do that using jQuery ? I hope what I ask is clear enough.
[jQuery] jQuery crashing older PCs in Firefox 3.0.5?
I have an older PC that I use for testing and I've noticed that when I use Firefox 3.0.5 that sometimes the PC crashes. Not just the browser, but the entire PC. I've yet to have a single crash in Opera 9.62 testing the same code. I forget the exact specs of the PC, but I think it's an AMD Athlon running at 1600mhz and I know it has 1.5 gigs of RAM. Has anyone else had FF/jQuery crashing issues? I'm crashing ONLY when executing jQuery code! In particular animation/easing.
[jQuery] Smarter way to write this repetitive code?
$('.headline:eq(0)').click(function() { $('.article-text:eq(0)').fadeIn(); }); $('.headline:eq(1)').click(function() { $('.article-text:eq(1)').fadeIn(); }); $('.headline:eq(2)').click(function() { $('.article-text:eq(2)').fadeIn(); }); Is there a smarter way to write that so it wasn't so repetitive? It is in practice here: http://css-tricks.com/i/ I'd like to be able to add and remove headlines without adding these chunks of code if possible.
[jQuery] replacing more than once
Total newbie. Any help appreciated. Why does replaceAll only seem to work once in this example? Thanks very much! !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=js/jquery.js type=text/javascript/script script var i = 0; $(document).ready(function(){ $(#firstButton).click(function () { $(#hello).replaceWith(foo); }); $(#secondButton).click(function () { $(#hello).replaceWith(bar); }); }); /script /head body button id=firstButtonFirst/button button id=secondButtonSecond/button pnbsp;/p table width=300 border=0 cellpadding=1 tr td id=hellohello/td /tr /table pnbsp;/p /body /html
[jQuery] problem in removing and moving
Hi, I want to remove an object, but also move a piece of it into previous HTML element, does exist something like ':prev' selector? Thanks! My code: JS: $('#to_move').insertAfter('#div dl:previous(?) dd'); $('#div dl:last').remove(); HTML: fieldset id=div dl dd...something.../dd !-- MOVE TO HERE -- /dl dl dd...something... span id=to_moveTO MOVE/span/dd /dl /fieldset
[jQuery] Re: Smarter way to write this repetitive code?
$('.headline').each(function(i) { $(this).click(function() { $('.article-text:eq('+i+')').fadeIn(); }) })
[jQuery] Re: Cluetip speed question
Hi David, I wrote both cluetip and simpletip. sorry cluetip didn't work out for you, but happy to see that you were able to use simpletip. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 20, 2008, at 4:25 PM, David Morton wrote: On Tue, Dec 16, 2008 at 6:26 PM, Michael Geary m...@mg.to wrote: http://osdir.com/answers/javascript/2618-jquery-optimizing-easiest-tooltip.html#2 Maybe you could use this code as a start for a custom tooltip plugin? Thanks for that link, I did manage to modify the simpletip.js library mentioned later down, and now the javascript portion of the page is 10ms in time. :) I couldn't find an email to thank the author in that, but here is the changeset with my modified version of the file for anyone else who may be interested: https://www.maiamailguard.com/maia/changeset/1367 -- David Morton morto...@gmail.com - bulk address morto...@dgrmm.net - direct to my server
[jQuery] Re: Smarter way to write this repetitive code?
Perfect! Thanks Ryura =) On Dec 20, 7:21 pm, Ryura yoyobo...@gmail.com wrote: $('.headline').each(function(i) { $(this).click(function() { $('.article-text:eq('+i+')').fadeIn(); }) })
[jQuery] Re: Problem with reloading AJAX content (Flowplayer) in jqModal window
I further simplified the problem by removing the jqModal component, so my problem appears to be with Flowplayer and AJAX. When you click the link, the script loads new html, and then a callback function instantiating Flowplayer, as well as triggering an alert from a new link. The first time the AJAX loads, Flowplayer appears properly and the alert triggers properly. But on subsequent loads, the alert still triggers properly, but Flowplayer does not appear. Any help is greatly appreciated! The code is below. 1. index.html body a id=ajaxLinkGet new AJAX content/a div id=ajax/div /body 2. ajax.html a id=player/a a id=getAlertClick for alert/a 3. ajax.js var loadFlowplayer = function() { $(#player).flowplayer(/swf/flowplayer-3.0.2.swf, { clip: { url: '/video/ab_raise.flv', autoPlay: false } }); $('#getAlert').click(function() { alert('Callback binding properly'); return false; }); } $(document).ready(function() { $('#ajaxLink').click(function() { $('#ajax').load('ajax.html', loadFlowplayer); return false; }); }); Cheers, and happy holidays! Jeff
[jQuery] Re: return value from JQuery ajax custom method
Thanks a lot Mike On Dec 19, 4:27 pm, Mike Alsup mal...@gmail.com wrote: I'm using jquery ajax within a custom method and try to return its result to that original method but I get nothing while it works fine if I show it in alert window here is my code: jQuery(document).ready(function() { jQuery.Test = function(){ jQuery.ajax({ type: POST, url: WebService.asmx/HelloWorld, success: function(msg) { // alert($(string, msg).text()); //it works fine return $(string, msg).text(); //it doesn't works }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(XMLHttpRequest.responseText); } }); }; alert(jQuery.Test());//it returns 'undefined' }); This should help: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_get_and_us...- Hide quoted text - - Show quoted text -