[jQuery] Re: toggleClass() help - assigning double class names that look like this: classname classname
Hey Wizzud. Thanks for your help - I figured it out. You're right - there was no reason to use the toggleClass function in this case. The addClass and removeClass were the way to go. It totally makes sense now - I'm just adding the active class to whatever existing class I need. This is very helpful! Here is my final code sample: function toggleMode(mediaType) { // reset all tabs $(.music).removeClass(active);$(.video).removeClass(active);$(.radio).removeClass(active); // set active if (mediaType == 1) $(.video).addClass(active); else if (mediaType == 2) $(.music).addClass(active); else if (mediaType == 3) $(.radio).addClass(active); } Thanks again! By the way - cool website ;) If all you want it to do is toggle *just* the active class then do exactly that... $('.video').toggleClass('active'); However, the $('.video') selector will never find any class='video active' because you've changed them all to class='active' in the previous code. Therefore it ( $('.video') ) will only ever pick up elements that do not have 'active' class, therefore toggling is a waste of effort and you might just as well do an addClass('active')! *If* that's what you want to do? If you want to toggle both video and active (leaving *just* 'active' as the class!?) then use $('.video').removeClass('video'.addClass('active'); If you want to do something else then describe it, or give a before/ after example. BTW $(.music.active).toggleClass(music); might just as well be $(.music.active).removeClass(music); because the selector restricts your toggleClass() to only ever being able to remove, never add! On Nov 22, 6:43 pm, [EMAIL PROTECTED] wrote: Hey Karl. That code just sets the element class attribute to empty: from this: a class=video/ to this a class=/ Thanks. Try $(.video).toggleClass(video active); Karl Rudd On Nov 22, 2007 10:23 AM, [EMAIL PROTECTED] wrote: The problem with the code below is that it modifies the tag to look like this: Code: a class=video video.active/ When it needs to look like this: Code: a class=video active/ Here is the code that I'm using: Code: function swapMode(mediaType) { $(.music.active).toggleClass(music); $(.video.active).toggleClass(video); $(.radio.active).toggleClass(radio); if (mediaType == 1) $(.video).toggleClass(.video.active); else if (mediaType == 2) $(.music).toggleClass(.music.active); else if (mediaType == 3) $(.radio).toggleClass(.radio.active); } Thanks for your help
[jQuery] Re: AJAX Security
1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe You can validate Captchas via ajax... Exactly, this is where I would like to go ;-) Just include captchas in your api. -- Fabien Meghazi Website: http://www.amigrave.com Email: [EMAIL PROTECTED] IM: [EMAIL PROTECTED]
[jQuery] Re: Question about comma separated selectors...
Karl Swedberg schrieb: Hi Stan, this topic has come up once before at least, and I can definitely understand the confusion. The conciseness of the syntax in this case perhaps leads to unexpected results. I'm not sure what the rationale is, but using a filter function should give you the results in the order you want them. Something like this maybe? $('div').filter(function() { return this.className.match(/classOne|classTwo/); }) That should give you the divs in the order they appear in the DOM. How about this: $(div).filter(.one, .two)? Jörn
[jQuery] Re: AJAX Security
howa schrieb: On 11月22日, 下午7時15分, Fabien Meghazi [EMAIL PROTECTED] wrote: In non AJAX apps, automatic checking can be prevented using Captcha in the registration page. As you could do with an AJAX application, I don't understand what would prevent you to do so. What main difference do you see between a GET or POST made by the browser when submitting a plain old form and a GET or POST made using XMLHttpRequest ? Hello, let consider a simple membership registration page 1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe You can validate Captchas via ajax... Jörn
[jQuery] Re: superfish bug?
Hello Joel, Thanks for your reply and your quick fix, everything works like a charm now! :) Regards Arjan
[jQuery] Problem 2 select boxes in same form
Newbie alert! I'm using jQuery to handle the show/hide of a div depending on option selected in a select box (based on code posted here previously): $(document).ready(function() { var $idOptionDivs = $([EMAIL PROTECTED]'IDoption']).hide(); var $rnOptionDivs = $([EMAIL PROTECTED]'reasonopt']).hide(); //display div's related to ID Option $('#doc_id').change(function() { var i = $('option', this).index( $(':selected')[0]); $idOptionDivs.hide().eq(i).show(); }); //display div's related to registration reason $('#reason').change(function() { var j = $('option', this).index( $(':selected')[0]); $rnOptionDivs.hide().eq(j).show(); }); }); The above code is linked to two simple select boxes - won't bore you with that code. Works fine if there is 1 select box but problem is when adding a second select box (say, another part of a registration form) the second select box doesn't pass the correct index - it always passes back '-1' no matter which option is selected. I know the code will work but I just can't understand why this error is occurring - bizarre thing is that when switching round the order of the select boxes the first one always works - second doesn't. Not sure if this is a jQuery issue but any help would be appreciated!! Thanks Al
[jQuery] $.post get error in firefox
use like this: $.post('/testurl/', { param1: value1 }, function(data) {alert(data)}); In firefox ,when I submit this ajax request,in the firebug it says,Loading...,but no return. in IE it works fine. but if I change the post to get ,it works well,or change {param1:'value1'} to a empty {},it also works well, why? how can I post data in ajax use jquery.
[jQuery] JQuery Tabs not loading on first click
Tabs are not loading on the first click. I have a link which is like: li class=newsa href=javascript:loadTabs('news')Headlines/a/ li when user clicks on this it calls the following function: script function loadTabs(filename) { $('head').append('link type=text/css href='+ webroot + 'css/ ui.tabs.css rel=stylesheet /'); $.getScript(webroot + script/ui.tabs.js); $.get(webroot + html/+filename+.htm, function(data){ $(#cbody).html(+data+); $(#newscontainer ul).tabs({ remote: true, fxSlide: true, fxFade: true, fxSpeed: 'normal' }); }); } /script this function loads the required css and javascript tabs file to display tabs; but when I click on it it gives me the following error: $(#newscontainer ul).tabs is not a function [Break on this error] $(#newscontainer ul).tabs({ remote: true, fxSlide: true, fxFade: true, fxSpe... However, it does work when I click on the link again. Any idea why this is happening? This wasn't happening on my dev server. Here is the link to the actual site: http://www.ranglapunjab.net/ Thanks in advance.
[jQuery] Re: Again on tablesorter and row hovering
Thanks a lot, this works like a charm:) Nevertheless I still need to make the hover css !important in order to have it visible. cheers Francesco -- View this message in context: http://www.nabble.com/Again-on-tablesorter-and-row-hovering-tf4852402s27240.html#a13908178 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: AJAX Security
Fabien Meghazi schrieb: 1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe You can validate Captchas via ajax... Exactly, this is where I would like to go ;-) Just include captchas in your api. I'm working on it: http://dev.jquery.com/view/trunk/plugins/validate/demo-test/captcha/index.php (currently rather broken). Jörn
[jQuery] Re: JQuery Tabs not loading on first click
On 23 Nov., 12:39, sukhminder [EMAIL PROTECTED] wrote: Tabs are not loading on the first click. I have a link which is like: li class=newsa href=javascript:loadTabs('news')Headlines/a/ li when user clicks on this it calls the following function: script function loadTabs(filename) { $('head').append('link type=text/css href='+ webroot + 'css/ ui.tabs.css rel=stylesheet /'); $.getScript(webroot + script/ui.tabs.js); $.get(webroot + html/+filename+.htm, function(data){ $(#cbody).html(+data+); $(#newscontainer ul).tabs({ remote: true, fxSlide: true, fxFade: true, fxSpeed: 'normal' }); });} /script this function loads the required css and javascript tabs file to display tabs; but when I click on it it gives me the following error: $(#newscontainer ul).tabs is not a function [Break on this error] $(#newscontainer ul).tabs({ remote: true, fxSlide: true, fxFade: true, fxSpe... However, it does work when I click on the link again. Any idea why this is happening? This wasn't happening on my dev server. Here is the link to the actual site:http://www.ranglapunjab.net/ Thanks in advance. My guess is this is due to asynchronous loading. When clicking first time ui.tabs.js gets loaded but when executing the tabs() method on the next line the browser is still loading the file. Second time you click it has been loaded, thus no error any longer. Try to call tabs in the callback of the getScript method: $.getScript(webroot + script/ui.tabs.js, function() { $(#newscontainer ul).tabs({ remote: true, fxSlide: true, fxFade: true, fxSpeed: 'normal' }); }); --Klaus
[jQuery] Re: fadeout a div after a few seconds
1. I beg to differ: it's your use of my reply that doesn't work 2. You can't fadeOut() text context, you can only fade an element. Therefore if you want to keep the outer div visible, then the inner text needs to wrapped in something (like another div?), and it's that 'something' that you fade out. 3. Your 'success' property callback needs to be a function, so either used a named function, eg... success: hidediv ...or an anonymous function, eg... success:function(response){ javascript_statements(s); } ...where hidediv is a function that accepts the response as an argument (as described in the documentation), eg... function hidediv(response){ // do something, like a delayed fadeOut maybe... setTimeout(function(){ $('#pdresult div').fadeOut('slow'); }, 2000); } //end function You could just use the anonymous function to do a (delayed) fade out, eg... success:function(response){ // you might want to do something with the response here as well // ... setTimeout(function(){ $(pdoptions.target + ' div').fadeOut('slow'); }, 2000); } On Nov 23, 3:44 pm, guix69 [EMAIL PROTECTED] wrote: Thanks for your reply but it doesn't work. I'm using the form plugin with its ajaxForm method so I have these options : var pdoptions = { target: '#pdresult', success: hidediv('pdresult')}; and I bind them to the form with : $('#pdform').ajaxForm(pdoptions); the hidediv function contains the code you gave me : function hidediv(name) { setTimeout(function(){ $('#'+name).fadeOut('slow'); }, 2000); }; But with all that, the hidediv function is executed as soon as I load the page with the form and I can see my empty 'pdresult' div disappear... So, to sum things up, I would say that I need the CONTENT of the div to be faded out a few seconds AFTER the form has been succesfully submitted :) Thanks again.
[jQuery] Re: Simple Question: Using Variables in jQuery
On Nov 24, 7:46 am, yetanother [EMAIL PROTECTED] wrote: I'm using an id tag (based on my database id) in my html to help direct traffic. On a click I use the following which grabs the variable from the id tag of the link: I presume you meant the id attribute of an A element. var myID = $(this).attr(id); I tested that with an alert and it works properly... Now then, if there was an unordered list with that same id later on the page That is invalid HTML, the value of an id attribute must be unique in the page. -- Rob
[jQuery] Re: Simple Question: Using Variables in jQuery
Try $(ul# + myID).load(data.html); Hope this helps, Glen On Nov 23, 2007 1:46 PM, yetanother [EMAIL PROTECTED] wrote: I'm using an id tag (based on my database id) in my html to help direct traffic. On a click I use the following which grabs the variable from the id tag of the link: var myID = $(this).attr(id); I tested that with an alert and it works properly... Now then, if there was an unordered list with that same id later on the page that I want to load the contents of a html file how would I do it? The following was my guess but I guessed wrong... $(ul#myID).load(data.html); Kindest, Wil
[jQuery] AJAX memory leak
Hi, Had some trouble with leaking memory and finally found out that it is not my fault but jQuerie's. The testscript is quite simple: for (var i=1; i=100; i++) $(#testarea).load(testload.php); The memory grows about 6MB everytime I press F5. I only get the memory back by closing the browser. Using latest SVN 1.2.1, IE 7, FF 2.0.0.9 Eric
[jQuery] Re: toggle hide show function not working (code provided)
That's even better. Thanks! On Nov 23, 1:03 pm, Wizzud [EMAIL PROTECTED] wrote: var bang = $('.bang').hide(); $('a.collapse').click(function(){ var vis = bang.is(':visible'); bang[ vis ? 'hide' : 'show' ](); $(this).text( vis ? '(+)' : '(-)' ); }); On Nov 23, 5:18 pm, mdrisser [EMAIL PROTECTED] wrote: Jay, Your code works great, but adds a couple of extra steps. Its not necessary to empty the html first, if you call .html() with an argument containing what you want to appear there, jQuery will clear the exisiting html for you and then replace it with what you had desired. // Works, but adds an extra step $('#myID').html('').append('pSomething I want to appear in myID/ p'); // Does the same thing, but with less typing ;-) $('#myID').html('pSomething I want to appear in myID/p'); Just a tip for those of us 'Lazy' Programmers ;-) On Nov 21, 11:16 am, Jay Fallon [EMAIL PROTECTED] wrote: You need to clear your HTML first. remove() does nothing. script type=text/javascript $(document).ready(function(){ $('div.bang').addClass('hide'); $('a.collapse').toggle(function(){ $('div.bang').show(); $('a.collapse').html().append((-)); }, function(){ $('div.bang').hide(); $('a.collapse').html().append((+)); });}); /script On Nov 21, 1:35 pm, FrankTudor [EMAIL PROTECTED] wrote: script type=text/javascript $(document).ready(function(){ $('.bang').hide(); $(a.collapse).toggle(function() { $('.bang').show(); $('a.collapse').remove((-)).append((+)); },function(){ $('.bang').hide(); $('a.collapse').remove((+)).append((-));}); }); /script head body a href= class=collapse(-)/a div class=bang Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean at magna nec erat tincidunt sollicitudin. Phasellus eu est. Aenean diam elit, laoreet sed, suscipit eget, hendrerit vel, lorem. Suspendisse nec turpis ullamcorper urna accumsan sollicitudin. /div Can someone put a set of eyes on the above code...It doesn't seem to work and I am not sure why. Thanks, Frank
[jQuery] Re: Concatenation
Thanks for the info. I do have Flanagan book and I did look for something, and found concat which was not what I wanted and thought Javascript did not do it. I should have look more and done a query for it on the web. Shame on me. Continue the good work ;) Llaurick On 23 nov, 14:42, Michael Geary [EMAIL PROTECTED] wrote: Llaurick, you won't find that in jQuery, but you don't need to, because it's a standard part of JavaScript. Since someone else had a similar question earlier today (tried to find something in jQuery but couldn't - because it's built into JavaScript itself), here's a general tip: If you ask, how do I do X with Y, where both X and Y are core JavaScript objects/statements/operators/whatever, then searching for it in jQuery won't usually help much. For example, there is no jQuery assignment statement, because that's just part of the JavaScript language. If X and Y are part of the DOM (HTML elements and all that stuff), then you probably *will* find a jQuery solution - the DOM is what jQuery deals with. If you're not sure whether something is part of core JavaScript or part of the DOM and other browser-specific JavaScript, Flanagan's book _JavaScript: the Definitive Guide_ breaks it out nicely, with separate sections for Core JavaScript and Client-Side JavaScript. Strings and arrays are part of the core JavaScript language, so that's where you'll find your solution. In other words, this search won't answer your question: http://www.google.com/search?q=jquery+array+string but this one will: http://www.google.com/search?q=javascript+array+string -Mike From: Llaurick I would like to know if there is a function (or any other way) in JQuery (or a plugin) that would allow to create a concatenation of a collection of String. What I would like is to take a list or array of strings (text) and create something like a comma separated value string with it.
[jQuery] Re: Can the cycle plugin return an index?
Inside my callback function I used this to get the current slide index with my Cycle object: $(myCycler).children().index(this); When I used incoming to find the index, it remained the same until the second click (third image/slide) On Oct 21, 8:17 am, Tobias Parent [EMAIL PROTECTED] wrote: Never mind, I answered my own question. For those who may need to know, you can use the index() call, so long as you provide a context. For example: var myPlayerWindow = $(#my-player-window); myPlayerWindow.cycle({after: afterSwitch}); function afterSwitch(incoming, outgoing, options) { $.debug(myPlayerWindow.children().index(incoming) ); // or, in my case... $(#slide-position).html(myPlayerWindow.children().index(incoming)+1); } Hope this helps someone else down the line! -Toby AIM: tobyParent [EMAIL PROTECTED] [ Attached Message ]From:Tobias Parent [EMAIL PROTECTED]To:jQuery Google Group jquery-en@googlegroups.comDate:Sun, 21 Oct 2007 11:45:26 -0400Local:Sun, Oct 21 2007 7:45 amSubject:[jQuery] Can the cycle plugin return an index?Hey, gang - I've got the cycle plugin working, just great, it's a beautiful thing. However, I have a after callback that needs to get the index of the currently displayed slide. Basically, it's displaying %% of %%% (for those who've got an RPG-II background...). I need to show what number of the current total we're on. Any ideas or suggestions, or do I go back to the drawing board? Thanks! - Toby AIM: tobyParent [EMAIL PROTECTED]
[jQuery] Re: fadeout a div after a few seconds
Thanks for your reply but it doesn't work. I'm using the form plugin with its ajaxForm method so I have these options : var pdoptions = { target: '#pdresult', success: hidediv('pdresult')}; and I bind them to the form with : $('#pdform').ajaxForm(pdoptions); the hidediv function contains the code you gave me : function hidediv(name) { setTimeout(function(){ $('#'+name).fadeOut('slow'); }, 2000); }; But with all that, the hidediv function is executed as soon as I load the page with the form and I can see my empty 'pdresult' div disappear... So, to sum things up, I would say that I need the CONTENT of the div to be faded out a few seconds AFTER the form has been succesfully submitted :) Thanks again.
[jQuery] Re: Problem with jQuery's SVN Repository
just use this url http://jqueryjs.googlecode.com/svn/trunk/ On Nov 23, 12:31 pm, Estevão Lucas [EMAIL PROTECTED] wrote: Hi, I would like to download the jQuery's SVN Repository with TortoiseSVN, but when i try to download the project with SVN Repository and put 'http://jqueryjs.googlecode.com/svn/trunk/jqueryjs-read-only; in URL label, this show: PROPFIND request failed on svn/trunk 403 Forbbiden. Can someone help me to download the repository??
[jQuery] problems about jquery.validate
Hi there, can jquery.validate use custom validator? And another problem is about email validator,it can't pass validate with my email address [EMAIL PROTECTED] exactly validate email address. sorry for my poor english. Best Regards Jacky
[jQuery] Re: Superfish Image menus
On Nov 23, 2007 3:27 AM, Joel Birch [EMAIL PROTECTED] wrote: On 23/11/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tried giving them different IDs and testing the same approach with .nav li #id with no success, the selector doesn't work. Not sure exactly where the problem lies, but that selector should probably be .nav li#id or just .nav #id and not .nav li #id, because I think you are intending to target the li that has a certain id, not an element that has the id and happens to be a child of an li. Maybe that helps, otherwise maybe if you post a link to your page we could help further. Thanks Joel, for you answer and your work in Superfish. I managed to make it work. I took a different approach, setting an individual background image for the a elements on the inline CSS style and then in the common stylesheet y scroll the background on hover for all the as and show their other state according to each background image. I don't know if this is the most elegant solution but it works fine. You can look at the result here. http://www.kingpin.com.ar/cryo/ In windows at least it displays correctly, in Linux I have an isue with flash content overlaping over the menu that I would like to solve also. Greetings Manuel.
[jQuery] Re: Fade and Center
To follow up on what Wizzud said. I just had a similar issue using the cycle plugin for jQuery. I wrote a custom transition called centerFade for it, I figured this out by using an example on this board posted by Mike Alsup. Below is the transition. jQuery.fn.cycle.transitions.centerFade= function($cont, $slides, opts) { var w = $cont.width(); var h = $cont.height(); var elW = $slides[0].offsetWidth; var elH = $slides[0].offsetHeight; var dx = ((w/2)-(elW/2)); var dy = ((h/2)-(elH/2)); opts.before.push(function(curr, next, opts) { jQuery(this).show(); opts.cssBefore = { top: dy, left: dx }; opts.cssAfter = { display: 'none' }; }); opts.cssFirst = { top: dy, left: dx }; opts.animIn = {opacity: 1 }; opts.animOut = {opacity: 0 }; }; To call it: $('#parent').cycle({ fx: 'centerFade', delay: 500, autostop: 1, }); This will wait half a second fade the child and then never fade again. You may need to modify the custom transition, to have the child hidden first then fade it, as this transition assumes you want the first slide displayed. Or in your example you could just add a dummy div, which has nothing in it, it will transition to the child div and then stop. Hope this helps. -jags78 On Nov 23, 6:43 am, Wizzud [EMAIL PROTECTED] wrote: Roughly: - get the width, height, top and left of the parent (width(), height() and offset()) - get the width and height of the child - calculate top and left of the child (simple maths) - set the top and left of the child according to the calculated values above (css()) - fade in child (fadeIn()) The above are not fixed in stone because it *very much* depends on what else is going on around the divs in question, whether there is other content in parent, and how the divs are 'position'ed (static, relative, absolute). For example, if parent is empty except for child, then you could vary the parent's padding, or the child's margins, to centre the child. If parent is relative and has other content that child will cover, then child will be absolute and the above applies. On the other hand, if parent is static (with other content) then you will have to position the absolute child according to the next non- static element up the DOM. Alternatively, if both never change in size, use styles to position them and simply fade in child when needed. There are too many variables/unknowns to be able to give a definitive answer. On Nov 22, 10:06 pm, shapper [EMAIL PROTECTED] wrote: Hello, I have 2 divs: div id=parent div id=child /div /div I need to create a function using JQuery that when called does the following: 1. Centers child inside parent 2. Fades in child How can I do this? Thanks, Miguel
[jQuery] Limits in Retrieving JSON with getJSON?
I am trying to get data from a database. I call an ASP page to retrieve a JSON recordset: $.getJSON('getRecordset.asp', { my request data } , function(data) {... It works but the JSON object I receive gets cut at a point (if I call the asp directly in the browser I see the whole recordset but via HttpRequest I can't) Example for n objects: -- [ {object1}, {object2}, {object (n-?)}, And no more. - The whole recordset can be 40K characters. It gets cut at some point between 14K and 15K chars. ¿Could anybody tell me if there's any limit with the amount of data I can receive? Thank you.
[jQuery] Re: Working with cluetip and validate
Great tip!! Thanks, Josh Feijó - Original Message - From: Josh Nathanson To: jquery-en@googlegroups.com Sent: Monday, November 19, 2007 11:01 PM Subject: [jQuery] Re: Working with cluetip and validate You do not have to use inline validate messages. You can use the configuration variable for this: $(#myform).validate({ messages: { myfield: you must enter a value. } }); -- Josh - Original Message - From: Alessandro Feijó To: jquery-en@googlegroups.com Sent: Monday, November 19, 2007 4:04 AM Subject: [jQuery] Working with cluetip and validate I just set a form using both plugins (jquery.validate.js and jquery.cluetip.js) Both use Title to set his content. So, a natural conflit is heppening. The cluetip title (before the pipe) its been the actualy content of validate red warning string. How can I circunvent that? If I can give a sugestion, both plugins could offer the possibility to set a custom attribute: input cluetip='My Title|my detail' validate='please inform this field' or, more simple to read: input cluetip_title='My Title' cluetip_detail='my detail' validate='please inform this field' I use custom attr in my drupal project without problems! Very pratical Thanks Feijó
[jQuery] Re: Help with jquery.autocomplete and extraParams
Hi Shawn, your feedback is welcome, and you make some good obversavations. The least I can say is: I'm working on it. Actually I've implemented a scrolling result list (both mouse and keyboard navigatable) today and tuned some other stuff (making it thickbox compatible). For a (too) long time I hesitated to promote my solution too much, to avoid lurking people into using a buggy and incomplete solution. Maybe that decision was wrong. But now I'm very near to be able to release 1.0 finally. Once that is done, I'll try to promote it, be it on the plugin page(s), be it on various other resources (say, ajaxian). When starting work on the autocomplete I talked with Dylan about it, and at least he has no problem to take his solution down. I'll try contact other authors, too. About the value-id issue: I want to tackle that, too. So far the plan is to provide an option replace or select (not sure about the name yet). Its just a boolean flag. Once set to true, it'll hide the input you apply the autocomplete to, create a new one (using the original name and append some suffix like _autocomplete), apply the same classes etc. and setup handlers to automatically write the select ID into the hidden field. So while it emulate a select 100% on the clientside, there won't be any difference for the serverside: The user selects some text, but submits a value. Let me know what you think about these aspects. Even feedback on names and suffixes is helpful :-) Regards Jörn
[jQuery] Re: toggle hide show function not working (code provided)
Jay, Your code works great, but adds a couple of extra steps. Its not necessary to empty the html first, if you call .html() with an argument containing what you want to appear there, jQuery will clear the exisiting html for you and then replace it with what you had desired. // Works, but adds an extra step $('#myID').html('').append('pSomething I want to appear in myID/ p'); // Does the same thing, but with less typing ;-) $('#myID').html('pSomething I want to appear in myID/p'); Just a tip for those of us 'Lazy' Programmers ;-) On Nov 21, 11:16 am, Jay Fallon [EMAIL PROTECTED] wrote: You need to clear your HTML first. remove() does nothing. script type=text/javascript $(document).ready(function(){ $('div.bang').addClass('hide'); $('a.collapse').toggle(function(){ $('div.bang').show(); $('a.collapse').html().append((-)); }, function(){ $('div.bang').hide(); $('a.collapse').html().append((+)); });}); /script On Nov 21, 1:35 pm, FrankTudor [EMAIL PROTECTED] wrote: script type=text/javascript $(document).ready(function(){ $('.bang').hide(); $(a.collapse).toggle(function() { $('.bang').show(); $('a.collapse').remove((-)).append((+)); },function(){ $('.bang').hide(); $('a.collapse').remove((+)).append((-));}); }); /script head body a href= class=collapse(-)/a div class=bang Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean at magna nec erat tincidunt sollicitudin. Phasellus eu est. Aenean diam elit, laoreet sed, suscipit eget, hendrerit vel, lorem. Suspendisse nec turpis ullamcorper urna accumsan sollicitudin. /div Can someone put a set of eyes on the above code...It doesn't seem to work and I am not sure why. Thanks, Frank
[jQuery] Re: Question about comma separated selectors...
Thanks Karl, I've done this - hopefully I can get some feedback and see if they've already addressed a fix for this and if it is even possible. Pax. On Nov 23, 10:11 am, Karl Swedberg [EMAIL PROTECTED] wrote: On Nov 23, 2007, at 9:39 AM, Stosh wrote: Perhaps I'm foolishly getting ahead of myself here, but the while loop around 1241 in find() seems to explain why this happens, is there any way of modifying find() so that it searches comma separated selector returning the results in DOM order? Or am I dreaming here? :) I'm especially wondering if this has been tried before and then discarded because of speed/performance issues. Stan, I think you've raised a really good question (one that, alas, I can't answer). I wonder if this would be better suited for the jquery- dev list, since it does involve an issue related to possible modification of the core script. Would you mind posting some form of this question on that list to see what kind of discussion it generates there? thanks! --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Re: Question about comma separated selectors...
Jörn, filter() appears to behave the same way that find() does, looping through and stacking the results in order, not by appearance in the DOM. Pax, - Stan On Nov 23, 3:05 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Karl Swedberg schrieb: Hi Stan, this topic has come up once before at least, and I can definitely understand the confusion. The conciseness of the syntax in this case perhaps leads to unexpected results. I'm not sure what the rationale is, but using a filter function should give you the results in the order you want them. Something like this maybe? $('div').filter(function() { return this.className.match(/classOne|classTwo/); }) That should give you the divs in the order they appear in the DOM. How about this: $(div).filter(.one, .two)? Jörn
[jQuery] Re: Question about comma separated selectors...
An observation I just noticed... To do the following... $(start).find('div.classOne, div.classTwo'); And have it order properly, with Karl's example it'd actually need to be: $(start).find('*').filter(function() { return this.className.match(/classOne|classTwo/); }) ; I just noticed this while trying it out. Pax, - Stan On Nov 23, 7:51 am, Wizzud [EMAIL PROTECTED] wrote: On Nov 23, 8:05 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: How about this: $(div).filter(.one, .two)? Jörn Nope, sorry. That will (A) filter for '.one', then (B) filter for '.two', returning the results of A appended by the results of B. So... div id='A' class='two'/div div id='B' class='one two'/div div id='C' class='two'/div div id='D' class='one'/div ...gets 5 results returned in BDABC order (which, btw, I think is a bug because the second B should not be there! - filter() should *not* be _expanding_ the original element set, even though it's by duplication; the returned set should be a subset of the originals and, ideally, unique.) The only way to do it (in current jQuery core) is, as Karl proposed, by using a function.
[jQuery] Re: Mixing two effects
Hi Karl, thanks. I had viewed that site once before, but not so extensively. But some advanced examples come close, so i will play with that one... The following link shows a bit what effect i want. http://www.commadot.com/jquery/faq.php If you click example one and after a few seconds again and so on But then with an image and without the need of clicking... But thanks, i'm going to play with your suggestion now :-) On Nov 23, 1:49 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Pathos, It sounds like the Cycle plugin would do something very similar to what you're looking for. http://www.malsup.com/jquery/cycle/ It's very customizable with all sorts of effects that you can apply to the transitions. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Nov 22, 2007, at 5:13 PM, Pathos wrote: Hi Brett, thanks for replying. The link on the second link doens't exist anymore. But the first is one part of the effect i'm after. I want a div to slide down with an image in it, after x seconds it slides up again en comes down again with another image. Without a trigger that would trigger the div to go up or down, just constantly after x seconds. And a loop after the last image to the first. I will try to find an example in flash, a real life image is always a better description :-) On Nov 21, 10:39 pm, Brett [EMAIL PROTECTED] wrote: Do these help?http://interface.eyecon.ro/demos/slideshow.html http://www.dzone.com/links/very_nice_jquery_slideshow.html On Nov 21, 3:30 am, Pathos [EMAIL PROTECTED] wrote: Hello everybody, after hearing about JQuery i am now plungin in and i really like the possibilities of jquery. I'm trying to get the next result and i'm not sure if its possible. I want a div to go down with an image and go up after x seconds and go down with a new image. I tried animated.innerfade and getting a div go up and down with: script type=text/javascript jQuery.noConflict(); jQuery(document).ready(function(){ jQuery(.klikdiv).toggle(function(){ jQuery(#downdiv).slideDown(slow); },function(){ jQuery(#downdiv).slideUp(slow); });}); /script But somehow these two didn't work together. I know that then the div only would slide when a link was clicked, but i wanted to try to get that effect out later. My question is if this is possible and maybe someone knows a better way of doing it or a plugin with this effect. Its an effect you see in Flash, but of course using jquery would be so much better :-) Greetings, Joris
[jQuery] Eval error with Firefox 3
Just a note: On AJAX calls where the data type is script, I get the following error: EvalError: function eval must be called directly, and not by way of a function of another name This error is triggered from line 501 of jquery 1.2.1 uncompressed. By the way, when an error is thrown, the exception parameter is always undefined for me.
[jQuery] Else If statements - why isn't this working?
This'll probably seem obvious to anyone with more jQuery knowledge than myself... I'm using the below code to show/hide specific divs according to which day it is. However, for some reason it isn't working. I've tried my best to find doumentation on how to write If/Else statements for jQuery but it's pretty thin on the ground... I've probably just missed something out. But, any ideas why none of the actions take place? $('body.schedule').ready( function(){ var today = new Date().getDay(); if (today == 2) { $(div.monday).hide(); } else if (today == 3) { $(div.monday).hide().next().hide(); } else if (today == 4) { $(div.monday).hide().next().hide().next().hide(); } else if (today == 5) { $(div.monday).hide().next().hide().next().hide().next().hide(); } else if (today == 6) { $ (div.monday).hide().next().hide().next().hide().next().hide().next().hide(); } else if (today == 7) { $ (div.monday).hide().next().hide().next().hide().next().hide().next().hide().next().hide(); } } ); Thanks in advance, Zarino Zappia
[jQuery] Re: clueTip: opening one tip closes another tip
Phew. I thought it was just me being stupid!! It is a great script and delivers 90% of what we are looking for - but when I sent it off for testing the main feedback was that users want to click on all the icons they can see - not open, then click the closebutton so that they can open another tip. You have thought out loud exactly what we need. If you think it might be doable in the short term please let me know. I will try to make it work at my end and report back - but we are running close to the deadline and I may need to change things round to appease the powers that be. Great work by the way and thanks for the quick response. PJ On Nov 23, 2:23 am, Karl Swedberg [EMAIL PROTECTED] wrote: On Nov 22, 2007, at 8:24 AM, PJ wrote: Hello I'm pretty sure I am missing atrick here - but just in case... I have the following collection of images/buttons that display a sticky clueTip when clicked: $('a.warn').cluetip({ activation: 'click', width: 180, 'sticky': true, cluetipClass: 'warning', dropShadow: true, 'closePosition': 'title', closeText: 'close', arrows: true }); Currently, with a tip A open, I have to close tip A before I open another tip (tip B) - clicking on the tip B launcher when tip A is open does nothing. I would like it so that, if I have tip A open already, then when i click to open tip B tip A closes itself. I hope that makes sense? Can clueTip cope with this or do I need to do something extra myself? Many Thanks Hi PJ, You're not missing anything. What you've described is a limitation of the plugin as it's currently implemented. I'm not sure how to go about making it work the way you would like it, but I'll give it some more thought. The problem is that, currently, if you have activation: click, the script tries to toggle the tooltip's visibility. When the tooltip is visible, it hides it; when it's hidden, it shows it. But, as you've pointed out, this becomes a problem when you click one link to show a tooltip and then immediately click another. It'll try to close it. Clicking again will show it with the new contents. I guess what I have to do (I'm thinking out loud now) is remember the actual element that gets clicked each time and then only hide the tooltip if the same element is clicked the next time. If something else is clicked, carry on as if the tooltip were hidden (reposition it and dump in the new contents). Again, I'll have to dig through the code and try to figure out how best to do this. But if anyone has a quick idea, feel free to jump in. :-) --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com- Hide quoted text - - Show quoted text -
[jQuery] Re: Question about comma separated selectors...
Thanks Karl. I did something similar in the end adding a new custom selector prefixed with the :, like: jQuery(a).is('.classOne') || jQuery(a).is('.classTwo') However, yours looks like it would execute faster and more efficiently, so I'll probably switch to using that. All aside though, is the rationale here performance? Or is this just how it was implemented and no one has proposed otherwise? Perhaps I'm foolishly getting ahead of myself here, but the while loop around 1241 in find() seems to explain why this happens, is there any way of modifying find() so that it searches comma separated selector returning the results in DOM order? Or am I dreaming here? :) I'm especially wondering if this has been tried before and then discarded because of speed/performance issues. Pax, - Stan On Nov 22, 10:53 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Stan, this topic has come up once before at least, and I can definitely understand the confusion. The conciseness of the syntax in this case perhaps leads to unexpected results. I'm not sure what the rationale is, but using a filter function should give you the results in the order you want them. Something like this maybe? $('div').filter(function() { return this.className.match(/classOne|classTwo/); }) That should give you the divs in the order they appear in the DOM. Cheers, --Karl On Nov 22, 2007, at 10:19 PM, Stosh wrote: Greetings, I have a general inquiry for the core dev guys... I noticed today while running a selector that comma separated selectors build their results by order of the selector and not by order they appear within the originating DOM. What I mean is, if I am running a selector that has say two different classes and I want nodes for both (ie. div.classOne and div.classTwo) I might run $ (start).find('div.classOne, div.classTwo). My expectation when I did this was that returned nodes would come in order of their appearance in the DOM, but instead the children matching div.classOne are found, and then the children for div.classTwo are found afterwards, even though they might appear in an order like this for example: [div.classOne, div.classTwo, div.classOne, div.classOne, div.classTwo]. What is the rationale behind running these selectors this way? Is this something that could be altered with a different syntax via a plugin or something like that? The only reason I even noticed this is because I ran the results through $.each() and needed to deal with the nodes in their appearance. I wound up figuring out a work around in the end for my particular situation, but this struck me as worth inquiring about. Anyhow, thanks in advance for any responses/replies/feedback on this one. Pax, - Stan Lemon
[jQuery] Re: Fade and Center
Roughly: - get the width, height, top and left of the parent (width(), height() and offset()) - get the width and height of the child - calculate top and left of the child (simple maths) - set the top and left of the child according to the calculated values above (css()) - fade in child (fadeIn()) The above are not fixed in stone because it *very much* depends on what else is going on around the divs in question, whether there is other content in parent, and how the divs are 'position'ed (static, relative, absolute). For example, if parent is empty except for child, then you could vary the parent's padding, or the child's margins, to centre the child. If parent is relative and has other content that child will cover, then child will be absolute and the above applies. On the other hand, if parent is static (with other content) then you will have to position the absolute child according to the next non- static element up the DOM. Alternatively, if both never change in size, use styles to position them and simply fade in child when needed. There are too many variables/unknowns to be able to give a definitive answer. On Nov 22, 10:06 pm, shapper [EMAIL PROTECTED] wrote: Hello, I have 2 divs: div id=parent div id=child /div /div I need to create a function using JQuery that when called does the following: 1. Centers child inside parent 2. Fades in child How can I do this? Thanks, Miguel
[jQuery] Re: toggleClass() help - assigning double class names that look like this: classname classname
No problem. btw you can simplify further if you wish... function toggleMode(mediaType) { $.each(['.video', '.music', '.radio'], function(n, v){ $(v)[(mediaType == n+1 ? 'add' : 'remove')+'Class']('active'); }); } On Nov 23, 9:01 am, [EMAIL PROTECTED] wrote: Hey Wizzud. Thanks for your help - I figured it out. You're right - there was no reason to use the toggleClass function in this case. The addClass and removeClass were the way to go. It totally makes sense now - I'm just adding the active class to whatever existing class I need. This is very helpful! Here is my final code sample: function toggleMode(mediaType) { // reset all tabs $(.music).removeClass(active);$(.video).removeClass(active);$(.radio).removeClass(active); // set active if (mediaType == 1) $(.video).addClass(active); else if (mediaType == 2) $(.music).addClass(active); else if (mediaType == 3) $(.radio).addClass(active); }
[jQuery] Re: AJAX Security
On 11月23日, 下午4時06分, Jörn Zaefferer [EMAIL PROTECTED] wrote: howa schrieb: On 11月22日, 下午7時15分, Fabien Meghazi [EMAIL PROTECTED] wrote: In non AJAX apps, automatic checking can be prevented using Captcha in the registration page. As you could do with an AJAX application, I don't understand what would prevent you to do so. What main difference do you see between a GET or POST made by the browser when submitting a plain old form and a GET or POST made using XMLHttpRequest ? Hello, let consider a simple membership registration page 1. Non AJAX User need to select a username, fill in the captcha, and submit the form = no automation possible as need to fill in the captcahe You can validate Captchas via ajax... Sure, but it oppose the original idea why you want to use AJAX for user to choose the username easily, well, this in fact related to doing Turing test on AJAX or RIA for max. usability.
[jQuery] Re: Question about comma separated selectors...
On Nov 23, 8:05 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: How about this: $(div).filter(.one, .two)? Jörn Nope, sorry. That will (A) filter for '.one', then (B) filter for '.two', returning the results of A appended by the results of B. So... div id='A' class='two'/div div id='B' class='one two'/div div id='C' class='two'/div div id='D' class='one'/div ...gets 5 results returned in BDABC order (which, btw, I think is a bug because the second B should not be there! - filter() should *not* be _expanding_ the original element set, even though it's by duplication; the returned set should be a subset of the originals and, ideally, unique.) The only way to do it (in current jQuery core) is, as Karl proposed, by using a function.
[jQuery] Re: Help with jquery.autocomplete and extraParams
Thanks Jorn. I did manage to figure it out, and actually redefined my needs so this trick was required.. :) Your suggestion to use your plugin highlights where I have a problem with the jQuery autocomplete solutions though. I'm only meaning to highlight a problem I perceive here, not to bash anyone. I do appreciate all the work going on... The problem is that there are 3 or 4 potential autocomplete solutions on the plugin page. When examining the details they all seem to provide the same basic capabilities. So were then left with the date of the project to figure out which one is more current. Right now, Dylan's has a date of Sept 07 (jquery.org is not resolving for me right now, so I can't get much more accurate). Your plugin has a date of early 2007. The others seem to be 2006ish. So one is left to believe that Dylan's is more recent and (hopefully) more stable. But it's only through taking part in the lists and digging through lots of comments that we find out your plugin is the more recent. Throw into the mix that for myself, I'm writing an application - not a web site. So I am doing lookups against a database and need to display the found text, but store and use the related ID field. This is workable in both, but the documentation for this is lacking. So in terms of simply doing an autocomplete, yep a plugin exists - though choosing the right plugin can be a challenge. In terms of using an autocomplete in a similar fashion as a drop down list (display text, but use the value), this is even more of a challenge. My thoughts are that you and Dylan (and Dan) all seem to be collaborating, so why not make this more apparent on the various web pages and provide a link to the recommended plugin? Or better yet, maybe jQuery should create a core autocomplete? (that's a challenge I know because there are so many different needs/use cases out there). But in the meantime documentation needs to be improved. I've already had to dig through Dylan's plugin to find options that seemed obvious but were not in his documentation (his docs do say they are out of date though...) I do appreciate the massive effort you and many others put into the excellent plugins I use and thank everyone for their hard work. Hopefully this will help highlight a perception problem from the general public.. :) Shawn Jörn Zaefferer wrote: Shawn schrieb: I'm using the autocomplete plugin found at http://www.dyve.net/jquery/?autocomplete. I'm trying to set a second parameter to be passed to my serverside code, and am getting odd behavior. I'm stumped on this one. [...] Any tips how I do this?? Thanks in advance. Try to specify a callback as the value (returning the value at the time the request is prepared), using this successor of Dylan's plugin: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ Until the 1.0 release is done (soon), you should give the latest revision a try: http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js Jörn
[jQuery] jCarousel: No width/height set for items.
I have implemented jCarousel dynamically loading images with AJAX. It runs fine until I click some other link on the page and it shows me the following error: jCarousel: No width/height set for items. This will cause an infinite loop. Aborting... Below is the part of the code what I am using: function gallery() { $('#cbody').html('div id=mycarousel class=jcarousel-skin- tangoul/ul/divdiv style=padding:10px;align:center id=dspPic/div'); $('#mycarousel').jcarousel({ scroll: 6, itemLoadCallback: mycarousel_itemLoadCallback }); }; function mycarousel_getItemHTML(url) { var url_m = url.replace(/small/g, ''); return 'a href=javascript:showPic(' + ' + url_m + ' +')img src=' + url + ' width=75 height=75 border=0//a'; }; function showPic(picurl) { $('#dspPic').html(img src=' + picurl + ' border='0' / ).animate({height: 'show',opacity: 'show'}, 'slow'); } Thanks!
[jQuery] Re: Question about comma separated selectors...
On Nov 23, 2007, at 9:39 AM, Stosh wrote: Perhaps I'm foolishly getting ahead of myself here, but the while loop around 1241 in find() seems to explain why this happens, is there any way of modifying find() so that it searches comma separated selector returning the results in DOM order? Or am I dreaming here? :) I'm especially wondering if this has been tried before and then discarded because of speed/performance issues. Stan, I think you've raised a really good question (one that, alas, I can't answer). I wonder if this would be better suited for the jquery- dev list, since it does involve an issue related to possible modification of the core script. Would you mind posting some form of this question on that list to see what kind of discussion it generates there? thanks! --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Problem with jQuery's SVN Repository
Hi, I would like to download the jQuery's SVN Repository with TortoiseSVN, but when i try to download the project with SVN Repository and put 'http://jqueryjs.googlecode.com/svn/trunk/ jqueryjs-read-only in URL label, this show: PROPFIND request failed on svn/trunk 403 Forbbiden. Can someone help me to download the repository??
[jQuery] Re: Else If statements - why isn't this working?
Hi Zarino, You won't find any documentation about jQuery's if/else statements for the same reason that you won't find any documentation on jQuery's assignment statement, arithmetic operators, or Date object. All those things are part of the JavaScript language itself, not part of jQuery. So of course you can use them all in jQuery code, but a search like this won't give you much useful information: http://www.google.com/search?q=jquery+if+else+statement In fact, your post from two hours ago is currently the fourth item in the results for that query. You're famous! :-) However, this search will give a wealth of information: http://www.google.com/search?q=javascript+if+else+statement OTOH, if/else statements are definitely not the best way to do what you're trying to do here. Any time you find yourself writing code that is this repetitious, that's a hint that there is probably a simpler way to do it. In fact, it's likely that you can do this in just a line or two of code. But I can't really suggest another approach yet, because I don't know for certain what it is you want to do. Can you post the related HTML code along with a description of exactly what you want to have happen? I do have one tip: The range of the getDay() function is 0 through 6, where 0 represents Sunday and 6 represents Saturday. So today == 7 will never happen, and today == 2 would be Tuesday, not Monday, etc. Anyway, post that HTML code and description and someone will be able to suggest a good way to do it. -Mike From: zarino This'll probably seem obvious to anyone with more jQuery knowledge than myself... I'm using the below code to show/hide specific divs according to which day it is. However, for some reason it isn't working. I've tried my best to find doumentation on how to write If/Else statements for jQuery but it's pretty thin on the ground... I've probably just missed something out. But, any ideas why none of the actions take place? $('body.schedule').ready( function(){ var today = new Date().getDay(); if (today == 2) { $(div.monday).hide(); } else if (today == 3) { $(div.monday).hide().next().hide(); } else if (today == 4) { $(div.monday).hide().next().hide().next().hide(); } else if (today == 5) { $(div.monday).hide().next().hide().next().hide().next().hide(); } else if (today == 6) { $ (div.monday).hide().next().hide().next().hide().next().hide( ).next().hide(); } else if (today == 7) { $ (div.monday).hide().next().hide().next().hide().next().hide( ).next().hide().next().hide(); } } ); Thanks in advance, Zarino Zappia
[jQuery] Re: clueTip: opening one tip closes another tip
On Nov 23, 2007, at 4:43 AM, PJ wrote: Phew. I thought it was just me being stupid!! Nope. that was me being stupid. ;-) It is a great script and delivers 90% of what we are looking for - but when I sent it off for testing the main feedback was that users want to click on all the icons they can see - not open, then click the closebutton so that they can open another tip. makes sense to me. You have thought out loud exactly what we need. If you think it might be doable in the short term please let me know. I will try to make it work at my end and report back - but we are running close to the deadline and I may need to change things round to appease the powers that be. glad we're on the same page. definitely doable. In fact, I've just uploaded a new version to svn with the changes: http://jqueryjs.googlecode.com/svn/trunk/plugins/cluetip/jquery.cluetip.js Great work by the way and thanks for the quick response. no problem. There is nothing that motivates me more than compliments, and yours were no exception. (In other words, flattery will get you everywhere with me.) :-) Let me know if you run into any problems with the new version. I haven't had a chance to test the latest changes in IE, but I don't foresee any issues. Cheers, Karl
[jQuery] Re: Eval error with Firefox 3
ff3 just in beta. jorn is working at mozilla, so don't worry about this... On Nov 23, 4:44 pm, Jerome Carty [EMAIL PROTECTED] wrote: Just a note: On AJAX calls where the data type is script, I get the following error: EvalError: function eval must be called directly, and not by way of a function of another name This error is triggered from line 501 of jquery 1.2.1 uncompressed. By the way, when an error is thrown, the exception parameter is always undefined for me.
[jQuery] Inserting at the caret
Hi all, Whats the best way to insert some content at the caret in a text field? Cheers, Mike
[jQuery] Concatenation
I would like to know if there is a function (or any other way) in JQuery (or a plugin) that would allow to create a concatenation of a collection of String. What I would like is to take a list or array of strings (text) and create something like a comma separated value string with it. Thanks for your help Llaurick.
[jQuery] Re: Working with cluetip and validate
I found that a few minutes after sent my msg to this group :) I have to thank you Karl a lot for that fabulous plugin! Feijó - Original Message - From: Karl Swedberg To: jquery-en@googlegroups.com Sent: Monday, November 19, 2007 3:17 PM Subject: [jQuery] Re: Working with cluetip and validate Hi Alessandro, You can already set a custom attribute with clueTip. Something like this, perhaps: $('mylink').cluetip({splitTitle: '|', titleAttribute: 'cluetip'}) input cluetip='My Title|my detail' title='whatever you want' Hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Nov 19, 2007, at 7:04 AM, Alessandro Feijó wrote: I just set a form using both plugins (jquery.validate.js and jquery.cluetip.js) Both use Title to set his content. So, a natural conflit is heppening. The cluetip title (before the pipe) its been the actualy content of validate red warning string. How can I circunvent that? If I can give a sugestion, both plugins could offer the possibility to set a custom attribute: input cluetip='My Title|my detail' validate='please inform this field' or, more simple to read: input cluetip_title='My Title' cluetip_detail='my detail' validate='please inform this field' I use custom attr in my drupal project without problems! Very pratical Thanks Feijó
[jQuery] Re: JQuery and ASP.NET.
There are a quite a number of different workable methods to implementing jquery and ASP.NET. If you are comfortable with writing custom server controls, then here is just one way: 1. For each control that uses jquery, add this to the OnPreRender event: Page.ClientScript.RegisterClientScriptInclude(jquery, path/to/jquery.js); This will only register the script once per page, and if no control needs jquery, the script will not be referenced at all. 2. Have a document.ready function defined as appropriate. Page.ClientScript.RegisterClientScriptBlock(this.GetType(), this.ID, $(document).ready(function(){ do_stuff(); });, true); 3. For Ajax calls, set up an IHttpHandler to receive ajax requests in the web.config httpHandlers add verb=* path=jQuery.ashx type=AjaxHandler, AssemblyNameGoesHere/ /httpHandlers 4. Build your IHttpHandler with this signature: public class AjaxHandler : IHttpHandler { public bool IsReusable{get{return false;}} public void ProcessRequest(HttpContext context) { // Disable client-side caching on the ajax call. context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.Cache.SetExpires(new DateTime(2000, 1, 1)); // Get the data about the ajax call from the // context.Request.QueryString and the // context.Request.Form collections, then: do_something_based_on_ajax_call_data(); context.Response.Write(result); context.Response.End(); } -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of shapper Sent: Wednesday, November 21, 2007 3:45 PM To: jQuery (English) Subject: [jQuery] JQuery and ASP.NET. Hello, I want to use JQuery on my ASP.NET projects. Consider the first example on the following page: http://p.sohei.org/stuff/jquery/tablehover/demo/demo.html I am trying to create a control to easy integrate JQuery into ASP.NET pages ... ... and also register commands as seen in the page example I am posting. I would like to receive some advices on how to do this? I am looking for JQuery advices on the best way to do this ... Thanks, Miguel
[jQuery] Re: Concatenation
Llaurick, you won't find that in jQuery, but you don't need to, because it's a standard part of JavaScript. Since someone else had a similar question earlier today (tried to find something in jQuery but couldn't - because it's built into JavaScript itself), here's a general tip: If you ask, how do I do X with Y, where both X and Y are core JavaScript objects/statements/operators/whatever, then searching for it in jQuery won't usually help much. For example, there is no jQuery assignment statement, because that's just part of the JavaScript language. If X and Y are part of the DOM (HTML elements and all that stuff), then you probably *will* find a jQuery solution - the DOM is what jQuery deals with. If you're not sure whether something is part of core JavaScript or part of the DOM and other browser-specific JavaScript, Flanagan's book _JavaScript: the Definitive Guide_ breaks it out nicely, with separate sections for Core JavaScript and Client-Side JavaScript. Strings and arrays are part of the core JavaScript language, so that's where you'll find your solution. In other words, this search won't answer your question: http://www.google.com/search?q=jquery+array+string but this one will: http://www.google.com/search?q=javascript+array+string -Mike From: Llaurick I would like to know if there is a function (or any other way) in JQuery (or a plugin) that would allow to create a concatenation of a collection of String. What I would like is to take a list or array of strings (text) and create something like a comma separated value string with it.
[jQuery] Re: jQuery UI Datepicker v3.0 Released! (Previously named jQuery Calendar)
+1 to this, particularly as the only way out of an accidental first selection is to close and re-open the datepicker. As an additional sweetener, it would be great if the unset date defaulted to today's date (i.e. if a user selects only a start date, the end date gets set to today and vice versa). Many thanks Marc and Keith for an excellent plugin. On Nov 1, 8:26 pm, MorningZ [EMAIL PROTECTED] wrote: I just have a small usuability suggestion for a future release In the Date Range implementation, make it so you could pick the either start or end date at any time... so just say a user choses Nov 20th first, then selects Nov 5th (whcih currently isn't possible as it locks out previous dates), it should be an easy check to flip-flop the dates so the first selection is the end date and the second selection is the begin Just a suggestion to a top notch date picker
[jQuery] Re: Inserting at the caret
Hi Mike, check out my plugin: http://laboratorium.0xab.cd/jquery/fieldselection/0.2.3-test/ The code is an unfinished mess, but you should get the point.. ;) Regards, Alex Mike Pearce wrote: Hi all, Whats the best way to insert some content at the caret in a text field? Cheers, Mike
[jQuery] Simple Question: Using Variables in jQuery
I'm using an id tag (based on my database id) in my html to help direct traffic. On a click I use the following which grabs the variable from the id tag of the link: var myID = $(this).attr(id); I tested that with an alert and it works properly... Now then, if there was an unordered list with that same id later on the page that I want to load the contents of a html file how would I do it? The following was my guess but I guessed wrong... $(ul#myID).load(data.html); Kindest, Wil