[jQuery] Re: element creation using wrap behaves oddly
yea! weird huh? yes the workarounds do work (and there's even a few more that i can think of) but i was simply scratching my head when i came up against the problem. ill see if i can make sense of the source, and perhaps submit a ticket so that someone with a better understanding can give it a look. thanks for your responses ricardo. On Sep 25, 10:04 pm, ricardobeat [EMAIL PROTECTED] wrote: Hmmm... Actually, after some tests I found my idea of this to be false. You can indeed attach event handlers before an element is inserted into the DOM. Sorry :D But I don't know what's weirder: this construct for wrapping/attaching a handler at the same time or that the wrap() function prevents the event function from being attached. I'm not sure it's technically a bug, but the elements do seem to lose it's bound functions when passed to the wrap() function. There must be a reason for that, like the element having to be recreated and it's impossible to recover functions bound to events, but I haven't looked at the code. Anyway, hope the alternatives I showed can be useful. cheers, - ricardo On 26 set, 01:28, darren [EMAIL PROTECTED] wrote: i don't see how creating the element, assigning the handler, and replacing or appending something works... yet, creating the element, assigning the handler, and wrapping it doesn't. can you help me understand what the difference is? On Sep 25, 5:39 pm, ricardobeat [EMAIL PROTECTED] wrote: It doesn't work for you because my code is not missing a ), actually I made a mistake on rewriting it. I'm assigning the click handler to the 'b' element which was wrapped, it's not inside thewrapfunction. It should read: $('b').wrap('a href=#/a').click(function(){ alert(foo); }); The second snippet I posted assigns it to the a that was created but it's not really needed. $('b').wrap('a href=#/a').parent().click(function(){ alert(foo); }); As I said before, you can't attach an event handler to the element before it is appended to the DOM. While you write the click() function inside thewrap() it will never work. - ricardo On Sep 25, 4:58 pm, darren [EMAIL PROTECTED] wrote: sorry for the double post, not sure how that happened. ricardo, your code is missing a closing ) at the end. it should be... $('b').wrap($('a href=#/a').click(function(){ alert(foo); })); your element creation: $('a href=#/a') is equivalent to the shorthand i used: $(a href='#'/) in either case, the click handler does not get assigned for me, so i am not sure how it works for you? On Sep 24, 1:30 pm, ricardobeat [EMAIL PROTECTED] wrote: I believe you can't assing an event handler to an element before it is added to the DOM. This works for me: $('b').wrap($('a href=#/a').click(function(){ alert(foo); }); Or if you want the click event assigned to a and not b $('b').wrap($('a href=#/a').parent().click(function(){ alert(foo); }); - ricardo On Sep 24, 3:08 pm, darren [EMAIL PROTECTED] wrote: i just want to bring this up for discussion to see what people have to say about it and to further my understanding of how jquery works and why it works that way. maybe its a bug? imagine the base code bHello World!/b // fails to assign click handler: $(a href='#'/).click(function(){ alert(foo); }) // also fails... wrapAll, wrapInner etc // works as expected: $(b).replaceWith($(a href='#'Hello World/a).click(function(){ alert(foo);})); // also works as expected: html, prepend, append, after, before, etc... i found thisodd. thoughts?
[jQuery] Re: element creation using wrap behaves oddly
Hmmm... Actually, after some tests I found my idea of this to be false. You can indeed attach event handlers before an element is inserted into the DOM. Sorry :D But I don't know what's weirder: this construct for wrapping/attaching a handler at the same time or that the wrap() function prevents the event function from being attached. I'm not sure it's technically a bug, but the elements do seem to lose it's bound functions when passed to the wrap() function. There must be a reason for that, like the element having to be recreated and it's impossible to recover functions bound to events, but I haven't looked at the code. Anyway, hope the alternatives I showed can be useful. cheers, - ricardo On 26 set, 01:28, darren [EMAIL PROTECTED] wrote: i don't see how creating the element, assigning the handler, and replacing or appending something works... yet, creating the element, assigning the handler, and wrapping it doesn't. can you help me understand what the difference is? On Sep 25, 5:39 pm, ricardobeat [EMAIL PROTECTED] wrote: It doesn't work for you because my code is not missing a ), actually I made a mistake on rewriting it. I'm assigning the click handler to the 'b' element which was wrapped, it's not inside thewrapfunction. It should read: $('b').wrap('a href=#/a').click(function(){ alert(foo); }); The second snippet I posted assigns it to the a that was created but it's not really needed. $('b').wrap('a href=#/a').parent().click(function(){ alert(foo); }); As I said before, you can't attach an event handler to the element before it is appended to the DOM. While you write the click() function inside thewrap() it will never work. - ricardo On Sep 25, 4:58 pm, darren [EMAIL PROTECTED] wrote: sorry for the double post, not sure how that happened. ricardo, your code is missing a closing ) at the end. it should be... $('b').wrap($('a href=#/a').click(function(){ alert(foo); })); your element creation: $('a href=#/a') is equivalent to the shorthand i used: $(a href='#'/) in either case, the click handler does not get assigned for me, so i am not sure how it works for you? On Sep 24, 1:30 pm, ricardobeat [EMAIL PROTECTED] wrote: I believe you can't assing an event handler to an element before it is added to the DOM. This works for me: $('b').wrap($('a href=#/a').click(function(){ alert(foo); }); Or if you want the click event assigned to a and not b $('b').wrap($('a href=#/a').parent().click(function(){ alert(foo); }); - ricardo On Sep 24, 3:08 pm, darren [EMAIL PROTECTED] wrote: i just want to bring this up for discussion to see what people have to say about it and to further my understanding of how jquery works and why it works that way. maybe its a bug? imagine the base code bHello World!/b // fails to assign click handler: $(a href='#'/).click(function(){ alert(foo); }) // also fails... wrapAll, wrapInner etc // works as expected: $(b).replaceWith($(a href='#'Hello World/a).click(function(){ alert(foo);})); // also works as expected: html, prepend, append, after, before, etc... i found thisodd. thoughts?
[jQuery] Re: Get Lightbox and Innerfade plugins work together
Yes i found a solution, here it is: I use prototype and lightbox with $ calls, and i enclose my other jquery calls this way: script language=javascript src=/js/jquery-1.2.6.js/script script language=javascript src=/js/jquery.innerfade.js/script script src=/js/lightbox/prototype.js type=text/javascript/script script src=/js/lightbox/scriptaculous.js?load=effects,builder type=text/javascript/script script src=/js/lightbox/lightbox.js type=text/javascript/script script language=javascript jQuery(document).ready( function(){ jQuery('div#portfolio').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '250px' }); } ); /script no more conflicts redcirce wrote: Ricardo, I had tried this already but it did not help. My understanding of the safe function is that it works to avoid conflicts between different libraries, ie. prototype and jquery. Both plugins/scripts (that I'm using at least) are jquery plugins. Amine, I wondered whether you had had any success or had found another solution? On Sep 24, 5:14 am, ricardobeat [EMAIL PROTECTED] wrote: hi, you can wrap all of your code in a safe function to avoid conflicts with other libraries that use '$': (function($){ // your jQuery code goes here })(jQuery); -ricardo On Sep 23, 5:32 am, Amine CHRAIBI [EMAIL PROTECTED] wrote: Hey, Thanks for your prompt answer, I will give it a try, even if it seems pretty heavy. I'll get back to you if I still can't sole this out. 2008/9/23 redcirce [EMAIL PROTECTED] Hello there. I had a similar problem to yours, which I have just solved now. I'm not sure if this is good coding or not, but it works which is enough for me. I was also using 2 plugins - lavalamp and coda-slider, both of which worked fine in isolation, but on the same page only the first plugin worked - the second of which did not. So this is how I fixed it: 1. I created a copy of jquery.js and called it jquery2.js 2. After the lavalamp scripts I called a second instance of jquery in the head for use with the coda-slider 3. I then opened up jquery2.js and replaced all $ with $j2 4. I opened all coda-slider scripts and as above, replaced all $ with $j2 All of which looks like this: !--first jquery call-- script src=js/jquery-1.2.6.js type=text/javascript/script !--all lavalamp scripts-- script type=text/javascript src=js/lavalamp.js/script script type=text/javascript src=js/easing.js/script script type=text/javascript $(function() { $(.lavaLamp).lavaLamp({ fx: backout, speed: 700 })}); /script !--second jquery call with $ changed to $j2-- script src=js/jquery2.js type=text/javascript/script !--all coda slider scripts with $ changed to $j2-- script type=text/javascript src=js/jquery-scrollTo-1.3.3.js/ script script type=text/javascriptsrc=js/jquery.localscroll-1.2.5.js charset=utf-8/script script type=text/javascriptsrc=js/jquery.serialScroll-1.2.1.js charset=utf-8/script script type=text/javascript src=js/coda-slider.js charset=utf-8/script HTH. If not, I'm sure someone more experienced can help out. Good luck. On Sep 23, 10:45 am, aminho [EMAIL PROTECTED] wrote: Hi all, I'm working on a website with lots of pictures. A part of it are displayed using the http://medienfreunde.com/lab/innerfade/Innerfadeplugin, and the reste are displayed usinghttp:// www.huddletogether.com/projects/lightbox2/Lightbox. The problem is that whenever i try to use both plugins on the same page, i'm facing strange troubles. Here is the http://pastie.org/276264headcontent of such page on my website. The error i'm getting is: $(document).ready is not a function I'm not that familiar with jquery plugins but i can't see the point there. When i use only innerfade, i have no error, and when i use only lightbox, i have no errors. I only get that when putting them together Anyone has an idea about the problem and maybe how to solve it ? Thanks a lot -- View this message in context: http://www.nabble.com/Get-Lightbox-and-Innerfade-plugins-work-togethe... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Get-Lightbox-and-Innerfade-plugins-work-together-tp19586053s27240p19683924.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Tabs with multiple CSS classes
You can change the class names via options (undocumented): $('#foo').tabs({ navClass: 'my-ui-tabs-nav' selectedClass: 'my-ui-tabs-selected', disabledClass: 'my ui-tabs-disabled', panelClass: 'my-ui-tabs-panel', loadingClass: 'my-ui-tabs-loading' }); Although I prefer to style different tabs on one page via context: .ui-tabs-nav { /* shared */ } #one .ui-tabs-nav { /* additional styles for the first tab interface */ } #two .ui-tabs-nav { /* additional styles for second tab interface */ } Or if you apply the id directly to the ul element: #one.ui-tabs-nav { /* additional styles for the first tab interface */ } --Klaus On 25 Sep., 17:04, Dan B. [EMAIL PROTECTED] wrote: Hi Folks, I'm interested in having multiple instances of tabs on a page/pages throughout a site and on the same page without using an iFrame. The tabs function is cool. I'd like to pass it a different base class, so that basically I have tab controls of different styles on the same page. Specifically I'm wanting to have this set of tabs have different widths; I'm looking for like a base-class option to pass to jquery.tabs or something. Any suggestions? dan
[jQuery] i was patient, now i'm frustrated
How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Re: Special characters with ajax.
You should use encodeURIComponent() From the jQuery core, they use this method to encode data for use with serialize(): encodeURIComponent(string).replace(/%20/g, +) On Sep 25, 5:08 pm, uncleroxk [EMAIL PROTECTED] wrote: i know that .serialize will encode it to a url safe character, but what if i decided not to use serialize, as serialize would not allow multiple selection for Option..
[jQuery] Re: Special characters with ajax.
further reading: http://xkr.us/articles/javascript/encode-compare/ On Sep 26, 9:40 am, Richard W [EMAIL PROTECTED] wrote: You should use encodeURIComponent() From the jQuery core, they use this method to encode data for use with serialize(): encodeURIComponent(string).replace(/%20/g, +) On Sep 25, 5:08 pm, uncleroxk [EMAIL PROTECTED] wrote: i know that .serialize will encode it to a url safe character, but what if i decided not to use serialize, as serialize would not allow multiple selection for Option..
[jQuery] Re: Closing modal element when clicking outside its border ...
Alright, I figured this out. I just bound a 'mousedown' event to the main 'document'. It then calls the 'checkMouse' function: $(document).bind('mousedown', checkMouse); var checkMouse = function(element) { var element = $(element.target)[0]; var observe = $('#form-drawer')[0]; while(true) { if(element == observe) { return true; } else if(element == document) { return closeEnterCallForm(); } else { element = $(element).parent()[0]; } } return true; }; On Sep 26, 11:35 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Alright, here's the deal. When a user clicks on a button, a form drops out that sits above the page's content. How would I close this form if the user decides to click else where?
[jQuery] Simple Queires for Function calling
1. I have some simple queries with regards to function calling. In plain javascript if I want to call a javascript function from my HTMl tag i do it like: input type=text id=myid onclick=javascript:sayHello(this.id); value=World / Now my javascript function would be defined as function sayHello(id) { alert(Hello + id.value); } Now I want to use JQuery to do such kind of programming wherein some value (not necessary something from the attribute) is passed t o the function and processing is done. Can anyone please guide me as to how can it be acomplished.
[jQuery] contains() not working
I have an image tag as img id=myimg src=images/expand.jpg / I am trying as if($(#myimg).attr(src).contains(expand)) // do something else //do something else but it gives an error Object doesn't support this property of method. Please help.
[jQuery] Re: Bind events on DOM elements inserted from other frame
That's what I tried first but couldn't get it to work, so I switched to using load function. I've created a demo page with 2 iframes - one using each method and only the load function works. You can find it here if you want to have a look to see if I've done something wrong. http://jquery.sallilump.com/bindtest/bind.html Paul On 26 Sep, 01:46, ricardobeat [EMAIL PROTECTED] wrote: Oh, that's right. But I think the best way would be $(document).ready(function(){ //theother code blabla //now that the iframe element exists $(frames.testframe.document).ready(function(){ }); }); On Sep 25, 4:56 pm, Paul Mills [EMAIL PROTECTED] wrote: The ready function fires when the iframe is ready in the DOM, not when the contents of the iframe are ready. I think you need to use the load function - a bit like this: $(window).load(function () { $('#test', frames['testframe'].document).click(function() { $(#hold).append('a href=#Inserted from iframe/a br /'); }); }); Paul On Sep 25, 6:37 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to put the code inside the $(document).ready function, it's not finding theiframebecause the DOM is not loaded. - ricardo On Sep 25, 12:36 pm, hubbs [EMAIL PROTECTED] wrote: Well, I tried this, but again it is not working, I really must be missing something. All I want to do it be able to click the link inside theiframe, and have it append some HTML into the parent, and apply a click event as well, that is all, seems simple! :) My test page: http://web2.puc.edu/PUC/files/bind.html Iframepage:http://web2.puc.edu/PUC/files/iframe.html Thanks for all the help. On Sep 24, 3:02 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, This works for me (FF3) (code running in the parent frame): $('#test',frames[0].document).click(function(){ //bindfunction to event from element *insideiframe* $('bTESTE/b').appendTo('body').click(function(){ // append element to the *parent frame* and assing a click handler to it alert('test'); }); }); I might not be understanding clearly what you want, a test case or explanation of the functionality you are looking for might help. cheers, - ricardo On Sep 24, 1:27 pm, hubbs [EMAIL PROTECTED] wrote: Hi Ricardo, I am not appending aniframe, it is hardcoded. I am trying to append to the parent document from within theiframe, and have the event in the parent bound to the appended element from theiframe. On Sep 23, 11:49 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, I can't test anything right now, but are you setting up the ready() function after appending theiframe? On Sep 23, 9:11 pm, hubbs [EMAIL PROTECTED] wrote: Yeah, this really is not working. Could someone please help me to understand how to make multiple frames use the same jquery instance so I can resolve this problem? Do I need to resort to frame ready plugin? I really don't want to... On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted fromiFrame/a br /'); In theiframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I canbindevents within theiframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using theiframe'sjQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of theiframeare always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same
[jQuery] Re: Simple Queires for Function calling
The same with jQuery looks like this: input type=text id=myid value=World / script type=text/javascript $(function() { //document.ready $(#myid).click(function() { alert( Hello + $(this).val() ); } }); /script You don't have to pass anything to the function since the 'this' context variable is equal to the element to which the event was bound. If you want to pass some other value to the function, there are a couple of ways to do that, but which one to pick would really depend on the what/why. In other words, it's hard to say without a more real scenario. - Richard Richard D. Worth http://rdworth.org/ On Thu, Sep 25, 2008 at 11:22 PM, JQueryProgrammer [EMAIL PROTECTED]wrote: 1. I have some simple queries with regards to function calling. In plain javascript if I want to call a javascript function from my HTMl tag i do it like: input type=text id=myid onclick=javascript:sayHello(this.id); value=World / Now my javascript function would be defined as function sayHello(id) { alert(Hello + id.value); } Now I want to use JQuery to do such kind of programming wherein some value (not necessary something from the attribute) is passed t o the function and processing is done. Can anyone please guide me as to how can it be acomplished.
[jQuery] Re: contains() not working
contains is a pseudo-selector, but not a method. So you can use it like this: html before: pthe quick brown/p pfox jumped over/p pthe lazy dog/p script: $(p:contains('the')).remove(); html after: pfox jumped over/p That doesn't really help in the scenario you've posed because contains searches the text of the element (see http://docs.jquery.com/Selectors/contains#text ). What you want is the attributeContains attribute selector. See: http://docs.jquery.com/Selectors Under Attribute Filters there is [attribute*=value] Matches elements that have the specified attribute and it contains a certain value. http://docs.jquery.com/Selectors/attributeContains#attributevalue So in your example that would be if ( $(#myimg[src*='expand']).length ) // do something else // do something else - Richard Richard D. Worth http://rdworth.org/ On Thu, Sep 25, 2008 at 11:21 PM, JQueryProgrammer [EMAIL PROTECTED]wrote: I have an image tag as img id=myimg src=images/expand.jpg / I am trying as if($(#myimg).attr(src).contains(expand)) // do something else //do something else but it gives an error Object doesn't support this property of method. Please help.
[jQuery] Re: Click function only invoked after second click in IE6 IE7
I did not fully realize the issue with the duplication of the ids from Thomas first post... Now I understand and have a working example to base my code on. Thank you very much for your help Richardo and Thomas.
[jQuery] jQuery infected by script.aculo.us
Hello, First of all, I need to get this working without touching markup. I really can't, only in very extreme cases. I'm loading jquery at the bottom of the body and script.aculo.us is on the head section. The main problem is: (I'm using jQuery.noConflict() and even tried myJq = jQuery.noConflict(true)) normally a jQuery('img',document.body) will return an object (Array) filled with the image elements. now, In the current page I'm stuck the jQuery('img',document.body) returns also an object but object[0] is a HTMLImageElement and this object also is an array that has all the image elements, so as you can imagine. jQuery('img',document.body).each() iterates over only 1 element and its the HTMLImageElement, and worse than that actually any query like jQuery('a') returns an array with 1 element and this element has all the desired elements. Please help me, is this documented? I can't find anythign about conflicts between both libraries. If I remove (I repeat this is a test, in the real thing I can't remove that) the script.aculo.us script everything is back to normal. HELP! :( please
[jQuery] Re: i was patient, now i'm frustrated
It looks like jquery.com isn't up right now, but the fix that was put in place recently (splitting each sub-domain off to its own server) *has* made a difference. For example http://docs.jquery.com/ (the site which most developers need most) is up right now, and quite responsive. If by chance you were going to jquery.com to download jQuery, you can get it here: http://docs.jquery.com/Downloading_jQuery - Richard On Fri, Sep 26, 2008 at 4:35 AM, Richard W [EMAIL PROTECTED] wrote: How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Re: Problem jQuery Selecting Input field
Also in the FAQ: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F - Richard On Thu, Sep 25, 2008 at 10:37 AM, MorningZ [EMAIL PROTECTED] wrote: Straight from the Docs (http://docs.jquery.com/Selectors) Note: if you wish to use any of the meta-characters described above as a literal part of a name, you must escape the character with two backslashes (\). For example: #foo\\:bar #foo\\[bar\\] #foo\\.bar So to select input type=text id=test:name it would be: $(input#test\\:name)
[jQuery] Re: i was patient, now i'm frustrated
Thank you for the response Richard. For me, (in London), the docs site takes on average about 3 minutes to load per page. (I just tried again now.) The pages do eventually load, it just takes forever for each page. Unfortunately I see no difference. I thank Remy Sharp for hosting a copy of the API. On Sep 26, 10:40 am, Richard D. Worth [EMAIL PROTECTED] wrote: It looks like jquery.com isn't up right now, but the fix that was put in place recently (splitting each sub-domain off to its own server) *has* made a difference. For examplehttp://docs.jquery.com/(the site which most developers need most) is up right now, and quite responsive. If by chance you were going to jquery.com to download jQuery, you can get it here: http://docs.jquery.com/Downloading_jQuery - Richard On Fri, Sep 26, 2008 at 4:35 AM, Richard W [EMAIL PROTECTED] wrote: How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Horizontal Splitter Problem
Hi, I have used vertical splitter along with JSF (facelets + richfaces) and YUI - it is working fine and PERFECT. however, I am unable to integerate the horizontal splitter in my code. Can any one plese help me out .. I am attaching the code below. Please someone help me in it .. ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:ui=http://java.sun.com/jsf/facelets; xmlns:h=http://java.sun.com/jsf/html; xmlns:t=http://myfaces.apache.org/tomahawk; xmlns:f=http://java.sun.com/jsf/core; xmlns:rich=http://richfaces.org/rich; xmlns:c=http://java.sun.com/jstl/core; xmlns:a4j=http://richfaces.org/a4j; ui:composition ui:debug hotkey=d/ c:set var=contextRoot value=#{facesContext.externalContext.request.contextPath} / head link type=text/css rel=stylesheet href=#{contextRoot}/css/palier.css/ link type=text/css rel=stylesheet href=#{contextRoot}/css/flexiblestyle.css/ link type=text/css rel=stylesheet href=#{contextRoot}/css/reset-fonts-grids.css/ script src=${contextRoot}/script/webScripts.js type=text/javascript/script script type=text/javascript src=#{contextRoot}/script/jquery-1.2.6.js/script script type=text/javascript src=#{contextRoot}/script/splitter.js/script link rel=stylesheet type=text/css href=#{contextRoot}/css/jquery-main.css / titleui:insert name=titleDefault title/ui:insert/title /head body style=margin: 0;padding: 0; f:view script language=javascript var disableRowClick = false; jQuery.noConflict(); /script !-- h:form id=palierForm enctype=multipart/form-data styleClass=formWrap -- !-- start doc3 div -- div id=doc3 class=yui-t1 a4j:region id=region !-- start hd -- div id=hd ui:include src=header.xhtml/ /div !-- start menu -- div id=menu ui:include src=menu.xhtml/ /div div id=bd div id =MyTestOne !-- start top -- div id=flexible-top class=yui-g !-- start column1 -- div id=flexible-col1 class=yui-u first ui:include src=leftPage.xhtml/ /div !-- start column2 -- div id=flexible-col2 class=yui-u ui:include src=rightPage.xhtml/ /div /div !-- end top -- !-- start bottom -- div id=flexible-bottom class=yui-g t:panelGroup id=bottomTabs forceId=true styleClass=fullHeight c:choose c:when test=#{genericController.bottomDivStyle != 'flexible-bottom-default'} div class=bottomColDiv ui:include src=#{genericController.bottomPage}/ /div /c:when c:otherwise ui:include src=#{genericController.bottomPage}/ /c:otherwise /c:choose /t:panelGroup /div !-- end bottom -- /div /div !-- bd -- rich:jQuery selector=##{genericController.topDivStyle} name=mysplit query=splitter({type: 'v',initA: true, minA: 300,maxA: 800}) timing=onload/ rich:jQuery selector=#MyTestOne name=horiSplit query=splitter({type: 'h'}) timing=onload/ rich:jQuery
[jQuery] Re: contains() not working
Thanks a ton. Although I had another way to do it like: if($(imgID).attr(src).indexOf(expand) = 0) but using the way you mentioned is more accurate and specific to JQuery. Thanks once again. On Sep 26, 2:27 pm, Richard D. Worth [EMAIL PROTECTED] wrote: contains is a pseudo-selector, but not a method. So you can use it like this: html before: pthe quick brown/p pfox jumped over/p pthe lazy dog/p script: $(p:contains('the')).remove(); html after: pfox jumped over/p That doesn't really help in the scenario you've posed because contains searches the text of the element (seehttp://docs.jquery.com/Selectors/contains#text). What you want is the attributeContains attribute selector. See: http://docs.jquery.com/Selectors Under Attribute Filters there is [attribute*=value] Matches elements that have the specified attribute and it contains a certain value.http://docs.jquery.com/Selectors/attributeContains#attributevalue So in your example that would be if ( $(#myimg[src*='expand']).length ) // do something else // do something else - Richard Richard D. Worthhttp://rdworth.org/ On Thu, Sep 25, 2008 at 11:21 PM, JQueryProgrammer [EMAIL PROTECTED]wrote: I have an image tag as img id=myimg src=images/expand.jpg / I am trying as if($(#myimg).attr(src).contains(expand)) // do something else //do something else but it gives an error Object doesn't support this property of method. Please help.
[jQuery] Re: Simple Queires for Function calling
Understand. But my issue is a bit different which i think i could not make it clear. I have a js file associated with every aspx page. Now my code is like input type=text id=myid onclick=javascript:sayHello(%= myValueFromServer%); / I tried to use the code (which is in my .js file) as: script type=text/javascript $(function() { //document.ready $(#myid).click(function() { alert( Hello + %= myValueFromServer% ); } }); But in .js file it does not resolve the %% value. Any help would be appreciated. On Sep 26, 2:13 pm, Richard D. Worth [EMAIL PROTECTED] wrote: The same with jQuery looks like this: input type=text id=myid value=World / script type=text/javascript $(function() { //document.ready $(#myid).click(function() { alert( Hello + $(this).val() ); } }); /script You don't have to pass anything to the function since the 'this' context variable is equal to the element to which the event was bound. If you want to pass some other value to the function, there are a couple of ways to do that, but which one to pick would really depend on the what/why. In other words, it's hard to say without a more real scenario. - Richard Richard D. Worthhttp://rdworth.org/ On Thu, Sep 25, 2008 at 11:22 PM, JQueryProgrammer [EMAIL PROTECTED]wrote: 1. I have some simple queries with regards to function calling. In plain javascript if I want to call a javascript function from my HTMl tag i do it like: input type=text id=myid onclick=javascript:sayHello(this.id); value=World / Now my javascript function would be defined as function sayHello(id) { alert(Hello + id.value); } Now I want to use JQuery to do such kind of programming wherein some value (not necessary something from the attribute) is passed t o the function and processing is done. Can anyone please guide me as to how can it be acomplished.
[jQuery] Re: Get parent url and add to a textarea
The HTML is - ul id=content_header_tools li id=tools_contact_usa href={path=contact-us/index}Contact Us/a/li li id=tools_email_pagea href={path=email-page/index} rel=email_pageEmail Page/a/li li id=tools_print_pagea href=javascript:window.print();Print Page/a/li /ul and this is part of what sits in my external file - $('a[rel=video_demo]').click(function(){ window.open(this.href,'mywindow','height=460,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=share_story], a[rel=video_story]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; On Sep 26, 10:31 am, ricardobeat [EMAIL PROTECTED] wrote: Now I'm completely lost. Could you post a test page? So where exactly is $(#message).get(0).value += window.opener.location.href; running? On Sep 25, 4:29 pm, stinhambo [EMAIL PROTECTED] wrote: Not at the moment. If I put it inside this - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); the popup comes up but the parent also loads the form and no URL gets carried across. On Sep 26, 2:46 am, ricardobeat [EMAIL PROTECTED] wrote: Is this line $(#message).get(0).value += window.opener.location.href; running from inside the popup? On Sep 25, 8:48 am, Stinhambo [EMAIL PROTECTED] wrote: I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] Re: Simple Queires for Function calling
Take a look at the metadata plugin: http://plugins.jquery.com/project/metadata - Richard On Fri, Sep 26, 2008 at 7:09 AM, JQueryProgrammer [EMAIL PROTECTED]wrote: Understand. But my issue is a bit different which i think i could not make it clear. I have a js file associated with every aspx page. Now my code is like input type=text id=myid onclick=javascript:sayHello(%= myValueFromServer%); / I tried to use the code (which is in my .js file) as: script type=text/javascript $(function() { //document.ready $(#myid).click(function() { alert( Hello + %= myValueFromServer% ); } }); But in .js file it does not resolve the %% value. Any help would be appreciated. On Sep 26, 2:13 pm, Richard D. Worth [EMAIL PROTECTED] wrote: The same with jQuery looks like this: input type=text id=myid value=World / script type=text/javascript $(function() { //document.ready $(#myid).click(function() { alert( Hello + $(this).val() ); } }); /script You don't have to pass anything to the function since the 'this' context variable is equal to the element to which the event was bound. If you want to pass some other value to the function, there are a couple of ways to do that, but which one to pick would really depend on the what/why. In other words, it's hard to say without a more real scenario. - Richard Richard D. Worthhttp://rdworth.org/ On Thu, Sep 25, 2008 at 11:22 PM, JQueryProgrammer [EMAIL PROTECTED] wrote: 1. I have some simple queries with regards to function calling. In plain javascript if I want to call a javascript function from my HTMl tag i do it like: input type=text id=myid onclick=javascript:sayHello(this.id); value=World / Now my javascript function would be defined as function sayHello(id) { alert(Hello + id.value); } Now I want to use JQuery to do such kind of programming wherein some value (not necessary something from the attribute) is passed t o the function and processing is done. Can anyone please guide me as to how can it be acomplished.
[jQuery] Re: Simple Queires for Function calling
But in .js file it does not resolve the %% value. Any help would be appreciated. As it shouldn't you've got a .js file, which IIS treats as plain ol text and passes through untouched, it will never get seen or more importantly processed by ASP.NET You've got options through: 1) Keep any dynamically created script in the asp or aspx page 2) create a new aspx page thats got all the JS markup inside it set it's ContentType to text/javascript But either way, the whole point of external js is so that the browser will cache it so it only needs to be downloaded once, so having changing values in a static js file doesn't make much sense anyways
[jQuery] suggestion - enable() / disable() functions
Dear all, I like jQuery much but I do not like the way the enabling, disabling elements is handled. This is a pretty common task and the current solution based on changing attributes is not in accord with jQuery’s “write less” philosophy. The enable() / disable() functions would be MUCH more elegant and in light with the jQuery gospel. Could this be included in the next release ? Best Martin
[jQuery] wrap function
I´m stuck, please help! My code: div class=box-two h1some header/h1 img name=Image src= width=250 height=200 alt=Image / pLorem ipsum dolor sit amet/p /div The jQuery: $(document).ready(function(){ $(div.box-two *).wrap('div class=inside/div'); }); The idea is to 'wrap' the h1, img and the p with a single div class=inside. The problem I have is that ALL the elements are individually wrapped with div class=inside. Not what I want! How can i tell jquery to do this?
[jQuery] Re: Plugin that offers smart tag-like functionality?
Thought someone might have done something like this. HTML would be something like this: div id=smarttag div id=smarttagicon img src=smarttagicon.gif width=16 height=16 / /div div id=smarttagcontent ul lia href=#Action 1/a/li lia href=#Action 2/a/li /ul /div /div And jQuery (kind of works, but not in IE and doesn't hide if hovering over the content and out without going over the icon first): $(smarttags); function smarttags() { $(#smarttagicon).hover( function() { $(#smarttagcontent).show(); },function(e) { // if not over the smarttag div, hide content if(!$(e.relatedTarget).parents(#smarttag).length) { $(#smarttagcontent).hide(); } } ); } The 'smarttag' div would be hidden initially, but populated and shown when hovering over an element that it is applied to. I suppose a smart tag is an extension of a tooltip (which doesn't disappear if you mouse over it). -- Sam On Sep 25, 5:07 pm, Rey Bango [EMAIL PROTECTED] wrote: Anyone know of a plugin that offers functionality like this? http://en.wikipedia.org/wiki/Image:Smarttags.PNG Rey...
[jQuery] treeview
Hello i hope someone can help this is driving me mad. Im using jquery-1.2.6.pack.js jquery-treeview.js jquery-cookie.js for a menu on www.bdct.nhs.uk everything works ok apart from in ie6 where some of the links disappear. but even this is inconsistent on different machines with ie6 installed. Can any one help? Also refreshing the page takes a long time is that because of the cookies? is there any way to speed this up? Cheers bdct
[jQuery] Re: text() as a wrapped set?
I could also do something along these lines: $.fn.oldText = $.fn.text; $.fn.text = function() { return $(document.createTextNode(this.oldText())); } That is, of course, if I'd like to confuse the hell out of future maintainers :) On Sep 25, 1:15 am, Balazs Endresz [EMAIL PROTECTED] wrote: I think the easiest way is to write another plugin: $.fn.$text=function(){ return $( document.createTextNode( this.text() ) ) } $(a).$text().appendTo(#sanbox); but you can extend the String prototype too: String.prototype.jqueryify=function(){ return $( document.createTextNode( this ) ) } $('a').text().jqueryify().appendTo(#sanbox); On Sep 24, 8:27 pm, 703designs [EMAIL PROTECTED] wrote: Because the text method returns a string, it's missing appendTo and other methods. Now, of course I can do this: $(#sandbox).text($(a).text()); But I'd prefer to do this: $(a).text().appendTo(#sanbox); What goes between text and appendTo? Or is the first example the best way to do this?
[jQuery] Re: text() as a wrapped set?
Oh, and break everything that depends on the text method. On Sep 26, 9:16 am, 703designs [EMAIL PROTECTED] wrote: I could also do something along these lines: $.fn.oldText = $.fn.text; $.fn.text = function() { return $(document.createTextNode(this.oldText())); } That is, of course, if I'd like to confuse the hell out of future maintainers :) On Sep 25, 1:15 am, Balazs Endresz [EMAIL PROTECTED] wrote: I think the easiest way is to write another plugin: $.fn.$text=function(){ return $( document.createTextNode( this.text() ) ) } $(a).$text().appendTo(#sanbox); but you can extend the String prototype too: String.prototype.jqueryify=function(){ return $( document.createTextNode( this ) ) } $('a').text().jqueryify().appendTo(#sanbox); On Sep 24, 8:27 pm, 703designs [EMAIL PROTECTED] wrote: Because the text method returns a string, it's missing appendTo and other methods. Now, of course I can do this: $(#sandbox).text($(a).text()); But I'd prefer to do this: $(a).text().appendTo(#sanbox); What goes between text and appendTo? Or is the first example the best way to do this?
[jQuery] Re: wrap function
Use wrapAll() method. Maujor -Mensagem Original- De: thelemondropkid [EMAIL PROTECTED] Para: jQuery (English) jquery-en@googlegroups.com Enviada em: sexta-feira, 26 de setembro de 2008 09:13 Assunto: [jQuery] wrap function I´m stuck, please help! My code: div class=box-two h1some header/h1 img name=Image src= width=250 height=200 alt=Image / pLorem ipsum dolor sit amet/p /div The jQuery: $(document).ready(function(){ $(div.box-two *).wrap('div class=inside/div'); }); The idea is to 'wrap' the h1, img and the p with a single div class=inside. The problem I have is that ALL the elements are individually wrapped with div class=inside. Not what I want! How can i tell jquery to do this?
[jQuery] Re: i was patient, now i'm frustrated
You're complaining why? Why should the jQuery site not loading affect your job in any way? The jQuery site offers nothing to me that I can't find elsewhere. I can get the most recent jQuery release from Google code, Remy Sharp has the API hosted on his site (or his downloable AIR app), and I have this mailing list. Why do you need the site at all? andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Richard W Sent: Friday, September 26, 2008 3:36 AM To: jQuery (English) Subject: [jQuery] i was patient, now i'm frustrated How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Re: wrap function
Good greef Samy! That works like a charm - I did not think it´s that simple. Thanks a million. Q. On Sep 26, 3:18 pm, Mauricio \(Maujor\) Samy Silva [EMAIL PROTECTED] wrote: Use wrapAll() method. Maujor -Mensagem Original- De: thelemondropkid [EMAIL PROTECTED] Para: jQuery (English) jquery-en@googlegroups.com Enviada em: sexta-feira, 26 de setembro de 2008 09:13 Assunto: [jQuery] wrap function I´m stuck, please help! My code: div class=box-two h1some header/h1 img name=Image src= width=250 height=200 alt=Image / pLorem ipsum dolor sit amet/p /div The jQuery: $(document).ready(function(){ $(div.box-two *).wrap('div class=inside/div'); }); The idea is to 'wrap' the h1, img and the p with a single div class=inside. The problem I have is that ALL the elements are individually wrapped with div class=inside. Not what I want! How can i tell jquery to do this?
[jQuery] Re: i was patient, now i'm frustrated
svn checkout http://jqueryjs.googlecode.com/svn/trunk/tools/api-browser jqueryapi open jqueryapi/index.html On Sep 26, 5:18 am, Richard W [EMAIL PROTECTED] wrote: Thank you for the response Richard. For me, (in London), the docs site takes on average about 3 minutes to load per page. (I just tried again now.) The pages do eventually load,
[jQuery] Re: jQuery infected by script.aculo.us
What version of jQuery and Scriptaculous are you using? Rey ricardoe wrote: Hello, First of all, I need to get this working without touching markup. I really can't, only in very extreme cases. I'm loading jquery at the bottom of the body and script.aculo.us is on the head section. The main problem is: (I'm using jQuery.noConflict() and even tried myJq = jQuery.noConflict(true)) normally a jQuery('img',document.body) will return an object (Array) filled with the image elements. now, In the current page I'm stuck the jQuery('img',document.body) returns also an object but object[0] is a HTMLImageElement and this object also is an array that has all the image elements, so as you can imagine. jQuery('img',document.body).each() iterates over only 1 element and its the HTMLImageElement, and worse than that actually any query like jQuery('a') returns an array with 1 element and this element has all the desired elements. Please help me, is this documented? I can't find anythign about conflicts between both libraries. If I remove (I repeat this is a test, in the real thing I can't remove that) the script.aculo.us script everything is back to normal. HELP! :( please
[jQuery] Re: jQuery infected by script.aculo.us
Hi Rey The jquery is 1.2.6 and scriptaculous is v1.7.0 Also an important note is: with prototype there's seem to be no problem, its when scriptaculous is added when everything is screwed. :( I've been debugging line by line (with firebug) the jQuery selector function and there's a time when it jumps to prototype.js code... I'll start again to see exactly where it happens but something related to bind() I think so. Thanks for the help! :) I think you can test with a file like this: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; dir=ltr head meta http-equiv=Content-Type content=text/html; charset=UTF-8 / titleDEMO/title script type=text/javascript src=/javascripts/jquery-1.2.6.js/script script type=text/javascript $$j = jQuery.noConflict(true); /script script type=text/javascript src=prototype.js/script script type=text/javascript src=/javascripts/scriptaculous.js/script script type=text/javascript $$j(document).ready(function(){ $$j(a).remove(); }); /script /head body a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a a href=#askdjSomething/a /body /html Then fire some $$('a') on firebug console and you will see what I'm talking about. Regards
[jQuery] Also...
Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js.
[jQuery] Re: i was patient, now i'm frustrated
This is a completely unrelated issue - we host jQuery.com (the homepage, blog, and dev) on a separate server with Rimuhosting. There was a power outage at the server facility and they're working ot bring it back up: http://rimuhosting.com/maintenance.jsp?server_maint_oid=68009362 The other sub-domains should be responding fine (docs, plugins, ui, code). --John On Fri, Sep 26, 2008 at 4:35 AM, Richard W [EMAIL PROTECTED] wrote: How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Re: jQuery infected by script.aculo.us
Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js.
[jQuery] Re: jQuery infected by script.aculo.us
Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js. Could you quote the relevant text from previous message(s) in your replies? For those of us who read the group on the mailing list, it makes it easier to keep track of what's being discussed. For this message, the part I had to hunt down was: The jquery is 1.2.6 and scriptaculous is v1.7.0 There's a known conflict between those two versions. I filed a bug report on it and it was rejected as wontfix. I can't get into the bug tracker or I would look up the bug number. The easiest fixes would be to either: 1) Upgrade Scriptaculous from 1.7.0 (which I believe was considered a beta) to the current release version, 1.8.1 or so. 2) Downgrade jQuery to 1.2.3. More work, but a better fix, would be to revisit the bug and come up with a patch. The problem is in this jQuery function: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.call ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, It's the array.call test at the end of the if statement. Scriptaculous 1.7.0 defines an Array.prototype.call method, which confuses that test. This jQuery code expects that arrays do *not* have a call method (nor split nor setInterval), so that addition by Scriptaculous causes this test to go wrong. I'm not sure what specific browser or condition that array.call test is supposed to guard against. (Ariel, if you happen to see this message, I believe this was your code; do you recall any of the specifics on why those three particular methods needed to be tested?) You could just try removing the array.call in your copy of jQuery and see what happens: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, That will fix the Scriptaculous conflict, but I don't know what other problems it may introduce. If it does cause any problems, then maybe there is some other method name that could be tested instead of array.call to achieve the same end. -Mike
[jQuery] Re: jQuery infected by script.aculo.us
Hi Michael, Sorry about the confusion. I'll try your solutions, but as I'm just invited to the page I'm working I can't downgrade scriptaculous. But I'll try with an older jquery or with the little tweak. I'll we back with the results. On 26 sep, 10:34, Michael Geary [EMAIL PROTECTED] wrote: Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js. Could you quote the relevant text from previous message(s) in your replies? For those of us who read the group on the mailing list, it makes it easier to keep track of what's being discussed. For this message, the part I had to hunt down was: The jquery is 1.2.6 and scriptaculous is v1.7.0 There's a known conflict between those two versions. I filed a bug report on it and it was rejected as wontfix. I can't get into the bug tracker or I would look up the bug number. The easiest fixes would be to either: 1) Upgrade Scriptaculous from 1.7.0 (which I believe was considered a beta) to the current release version, 1.8.1 or so. 2) Downgrade jQuery to 1.2.3. More work, but a better fix, would be to revisit the bug and come up with a patch. The problem is in this jQuery function: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.call ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, It's the array.call test at the end of the if statement. Scriptaculous 1.7.0 defines an Array.prototype.call method, which confuses that test. This jQuery code expects that arrays do *not* have a call method (nor split nor setInterval), so that addition by Scriptaculous causes this test to go wrong. I'm not sure what specific browser or condition that array.call test is supposed to guard against. (Ariel, if you happen to see this message, I believe this was your code; do you recall any of the specifics on why those three particular methods needed to be tested?) You could just try removing the array.call in your copy of jQuery and see what happens: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, That will fix the Scriptaculous conflict, but I don't know what other problems it may introduce. If it does cause any problems, then maybe there is some other method name that could be tested instead of array.call to achieve the same end. -Mike
[jQuery] Re: jQuery infected by script.aculo.us
But can you upgrade it? The reason I had asked the version was for the reason the Mike mentioned, the conflict in makeArray. Mind you that this is not a bug in jQuery but an issue in several prior releases of Scriptaculous where they decided to overwrite the default behavior of the call method. They fixed it in subsequent releases. Rey... ricardoe wrote: Hi Michael, Sorry about the confusion. I'll try your solutions, but as I'm just invited to the page I'm working I can't downgrade scriptaculous. But I'll try with an older jquery or with the little tweak. I'll we back with the results. On 26 sep, 10:34, Michael Geary [EMAIL PROTECTED] wrote: Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js. Could you quote the relevant text from previous message(s) in your replies? For those of us who read the group on the mailing list, it makes it easier to keep track of what's being discussed. For this message, the part I had to hunt down was: The jquery is 1.2.6 and scriptaculous is v1.7.0 There's a known conflict between those two versions. I filed a bug report on it and it was rejected as wontfix. I can't get into the bug tracker or I would look up the bug number. The easiest fixes would be to either: 1) Upgrade Scriptaculous from 1.7.0 (which I believe was considered a beta) to the current release version, 1.8.1 or so. 2) Downgrade jQuery to 1.2.3. More work, but a better fix, would be to revisit the bug and come up with a patch. The problem is in this jQuery function: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.call ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, It's the array.call test at the end of the if statement. Scriptaculous 1.7.0 defines an Array.prototype.call method, which confuses that test. This jQuery code expects that arrays do *not* have a call method (nor split nor setInterval), so that addition by Scriptaculous causes this test to go wrong. I'm not sure what specific browser or condition that array.call test is supposed to guard against. (Ariel, if you happen to see this message, I believe this was your code; do you recall any of the specifics on why those three particular methods needed to be tested?) You could just try removing the array.call in your copy of jQuery and see what happens: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, That will fix the Scriptaculous conflict, but I don't know what other problems it may introduce. If it does cause any problems, then maybe there is some other method name that could be tested instead of array.call to achieve the same end. -Mike
[jQuery] Re: jQuery infected by script.aculo.us
Hi Rey, Its not an easy option but its reasonable, so I'll test it. For now, my tests confirm what Michael said, the array.call its the picky line, I removed it and everything is working fine again, if someone can make a call to John Resig :D asking if its ok if we remove that :) So I'm with 3 options right now (easier first): 1) Patch my jquery 2) Downgrade my jquery 3) Update Scriptaculous Keep the suggestions coming, and I'm very thankful to all of you, this is a great b-day gift for me :) On 26 sep, 12:03, Rey Bango [EMAIL PROTECTED] wrote: But can you upgrade it? The reason I had asked the version was for the reason the Mike mentioned, the conflict in makeArray. Mind you that this is not a bug in jQuery but an issue in several prior releases of Scriptaculous where they decided to overwrite the default behavior of the call method. They fixed it in subsequent releases. Rey... ricardoe wrote: Hi Michael, Sorry about the confusion. I'll try your solutions, but as I'm just invited to the page I'm working I can't downgrade scriptaculous. But I'll try with an older jquery or with the little tweak. I'll we back with the results. On 26 sep, 10:34, Michael Geary [EMAIL PROTECTED] wrote: Its important to know that I'm almost unable to change a bit of markup or other js libraries code, I'm being injected along with jQuery to this site, so I'm more like a guest in this uber-mix of js. Could you quote the relevant text from previous message(s) in your replies? For those of us who read the group on the mailing list, it makes it easier to keep track of what's being discussed. For this message, the part I had to hunt down was: The jquery is 1.2.6 and scriptaculous is v1.7.0 There's a known conflict between those two versions. I filed a bug report on it and it was rejected as wontfix. I can't get into the bug tracker or I would look up the bug number. The easiest fixes would be to either: 1) Upgrade Scriptaculous from 1.7.0 (which I believe was considered a beta) to the current release version, 1.8.1 or so. 2) Downgrade jQuery to 1.2.3. More work, but a better fix, would be to revisit the bug and come up with a patch. The problem is in this jQuery function: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.call ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, It's the array.call test at the end of the if statement. Scriptaculous 1.7.0 defines an Array.prototype.call method, which confuses that test. This jQuery code expects that arrays do *not* have a call method (nor split nor setInterval), so that addition by Scriptaculous causes this test to go wrong. I'm not sure what specific browser or condition that array.call test is supposed to guard against. (Ariel, if you happen to see this message, I believe this was your code; do you recall any of the specifics on why those three particular methods needed to be tested?) You could just try removing the array.call in your copy of jQuery and see what happens: makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, That will fix the Scriptaculous conflict, but I don't know what other problems it may introduce. If it does cause any problems, then maybe there is some other method name that could be tested instead of array.call to achieve the same end. -Mike
[jQuery] livequery and iui
hi, I usually don't work with iui (iphone) but have some code and wanna adapt it to play with jquery. The problem is to attache events to the new generated DOM at each ajax request in iui (using jquery AJAX I would make a callback, but...). Finally discovered livequery but seems not to work this very very simple code in http://edit.csic.es/fitxers/gbifs/index.html : var example=function() {alert(clickiiin)}; $('li') .livequery('click',example); //each newly generated li should alert when clicking some help? thanks Pere Roca visita l'EDIT mapViewer! http://edit.csic.es/edit_geo/prototype/edit.html -- View this message in context: http://www.nabble.com/livequery-and-iui-tp19692949s27240p19692949.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery infected by script.aculo.us
Yay! Thanks Ariel, I'll keep that on mind. For now we're dealing with the manager of the host-page because everything is caused by a WP plugin known as mp3inline, they are using old prototype libs. Thanks for all everybody (if someday you came to México, you will get a free shot of Mezcal) ;) On 26 sep, 12:57, Ariel Flesler [EMAIL PROTECTED] wrote: Let me add another option, you can either: - Upgrade Scriptaculous - Downgrade jQuery - Upgrade jQuery to the version on the trunk. This last option is the new one and I sort of announced that already (on jquery-dev I think). The version on the trunk patches (I wouldn't say fixes) the conflict with Scriptaculous. Still, it's not a formally stable version but should do fine. I think it's important to make it clear (as Rey said) that this was not a bug on jQuery, but a conflict effects.js created when adding Array.prototype.call. Cheers -- Ariel Fleslerhttp://flesler.blogspot.com On Sep 26, 5:46 am, ricardoe [EMAIL PROTECTED] wrote: Hello, First of all, I need to get this working without touching markup. I really can't, only in very extreme cases. I'm loading jquery at the bottom of the body and script.aculo.us is on the head section. The main problem is: (I'm using jQuery.noConflict() and even tried myJq = jQuery.noConflict(true)) normally a jQuery('img',document.body) will return an object (Array) filled with the image elements. now, In the current page I'm stuck the jQuery('img',document.body) returns also an object but object[0] is a HTMLImageElement and this object also is an array that has all the image elements, so as you can imagine. jQuery('img',document.body).each() iterates over only 1 element and its the HTMLImageElement, and worse than that actually any query like jQuery('a') returns an array with 1 element and this element has all the desired elements. Please help me, is this documented? I can't find anythign about conflicts between both libraries. If I remove (I repeat this is a test, in the real thing I can't remove that) the script.aculo.us script everything is back to normal. HELP! :( please
[jQuery] Re: Bind events on DOM elements inserted from other frame
Hope you don't mind turning your thread into a discussion :) now that sounds like a bug. $(document).ready(function(){ $(frames.testframe2.document).ready(function(){ $('#test',frames.testframe2.document); }); }); The inner ready() function is fired exactly at the same time as the parent document. So, the jQuery object returns empty because the DOM is not loaded for the iframe yet. I wonder why is the function fired if the DOM is not ready? It would be nice to have the same advantages ready() offers over the load event for iframes. Any thoughts? - ricardo On Sep 26, 6:11 am, Paul Mills [EMAIL PROTECTED] wrote: That's what I tried first but couldn't get it to work, so I switched to using load function. I've created a demo page with 2 iframes - one using each method and only the load function works. You can find it here if you want to have a look to see if I've done something wrong.http://jquery.sallilump.com/bindtest/bind.html Paul On 26 Sep, 01:46, ricardobeat [EMAIL PROTECTED] wrote: Oh, that's right. But I think the best way would be $(document).ready(function(){ //theother code blabla //now that the iframe element exists $(frames.testframe.document).ready(function(){ }); }); On Sep 25, 4:56 pm, Paul Mills [EMAIL PROTECTED] wrote: The ready function fires when the iframe is ready in the DOM, not when the contents of the iframe are ready. I think you need to use the load function - a bit like this: $(window).load(function () { $('#test', frames['testframe'].document).click(function() { $(#hold).append('a href=#Inserted from iframe/a br /'); }); }); Paul On Sep 25, 6:37 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to put the code inside the $(document).ready function, it's not finding theiframebecause the DOM is not loaded. - ricardo On Sep 25, 12:36 pm, hubbs [EMAIL PROTECTED] wrote: Well, I tried this, but again it is not working, I really must be missing something. All I want to do it be able to click the link inside theiframe, and have it append some HTML into the parent, and apply a click event as well, that is all, seems simple! :) My test page: http://web2.puc.edu/PUC/files/bind.html Iframepage:http://web2.puc.edu/PUC/files/iframe.html Thanks for all the help. On Sep 24, 3:02 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, This works for me (FF3) (code running in the parent frame): $('#test',frames[0].document).click(function(){ //bindfunction to event from element *insideiframe* $('bTESTE/b').appendTo('body').click(function(){ // append element to the *parent frame* and assing a click handler to it alert('test'); }); }); I might not be understanding clearly what you want, a test case or explanation of the functionality you are looking for might help. cheers, - ricardo On Sep 24, 1:27 pm, hubbs [EMAIL PROTECTED] wrote: Hi Ricardo, I am not appending aniframe, it is hardcoded. I am trying to append to the parent document from within theiframe, and have the event in the parent bound to the appended element from theiframe. On Sep 23, 11:49 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, I can't test anything right now, but are you setting up the ready() function after appending theiframe? On Sep 23, 9:11 pm, hubbs [EMAIL PROTECTED] wrote: Yeah, this really is not working. Could someone please help me to understand how to make multiple frames use the same jquery instance so I can resolve this problem? Do I need to resort to frame ready plugin? I really don't want to... On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted fromiFrame/a br /'); In theiframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I canbindevents within theiframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote:
[jQuery] Re: jQuery infected by script.aculo.us
Let me add another option, you can either: - Upgrade Scriptaculous - Downgrade jQuery - Upgrade jQuery to the version on the trunk. This last option is the new one and I sort of announced that already (on jquery-dev I think). The version on the trunk patches (I wouldn't say fixes) the conflict with Scriptaculous. Still, it's not a formally stable version but should do fine. I think it's important to make it clear (as Rey said) that this was not a bug on jQuery, but a conflict effects.js created when adding Array.prototype.call. Cheers -- Ariel Flesler http://flesler.blogspot.com On Sep 26, 5:46 am, ricardoe [EMAIL PROTECTED] wrote: Hello, First of all, I need to get this working without touching markup. I really can't, only in very extreme cases. I'm loading jquery at the bottom of the body and script.aculo.us is on the head section. The main problem is: (I'm using jQuery.noConflict() and even tried myJq = jQuery.noConflict(true)) normally a jQuery('img',document.body) will return an object (Array) filled with the image elements. now, In the current page I'm stuck the jQuery('img',document.body) returns also an object but object[0] is a HTMLImageElement and this object also is an array that has all the image elements, so as you can imagine. jQuery('img',document.body).each() iterates over only 1 element and its the HTMLImageElement, and worse than that actually any query like jQuery('a') returns an array with 1 element and this element has all the desired elements. Please help me, is this documented? I can't find anythign about conflicts between both libraries. If I remove (I repeat this is a test, in the real thing I can't remove that) the script.aculo.us script everything is back to normal. HELP! :( please
[jQuery] Can jQuery do it again and again?
Thanks to the help I have received on this group, I am making progress. But now that all is working fine, the question beckons: Can jQuery do it all over again? This is my code: div class=box h3some header/h3 img name=Image src=photo.jpg width=268 height=122 alt= / pLorem ipsum dolor sit amet./p /div And the jQuery: $(document).ready(function(){ $(div.box *).wrapAll('div class=inside/div'); $(div.box).append('div class=tl/div'+'div class=tr/ div'+'div class=bl/div'+'div class=br/div'); }); The problem: I would have thought that jQuery would repeat the above process if I created another div with a class of box below the previous one. I was wrong! Is there a way to do that because I would like to create various boxes with a class of box and have them all look the same. Thanks folks
[jQuery] Re: Can jQuery do it again and again?
LiveQuery would handle that http://brandonaaron.net/docs/livequery/ On Sep 26, 2:17 pm, thelemondropkid [EMAIL PROTECTED] wrote: Thanks to the help I have received on this group, I am making progress. But now that all is working fine, the question beckons: Can jQuery do it all over again? This is my code: div class=box h3some header/h3 img name=Image src=photo.jpg width=268 height=122 alt= / pLorem ipsum dolor sit amet./p /div And the jQuery: $(document).ready(function(){ $(div.box *).wrapAll('div class=inside/div'); $(div.box).append('div class=tl/div'+'div class=tr/ div'+'div class=bl/div'+'div class=br/div'); }); The problem: I would have thought that jQuery would repeat the above process if I created another div with a class of box below the previous one. I was wrong! Is there a way to do that because I would like to create various boxes with a class of box and have them all look the same. Thanks folks
[jQuery] Re: livequery and iui
In this particular case event delegation might serve you better. Live Query really only works if you are using jQuery methods to modify/manipulate the DOM. The iui code does not use jQuery and that is why Live Query can't see those particular updates. -- Brandon Aaron On Fri, Sep 26, 2008 at 12:25 PM, pere roca [EMAIL PROTECTED] wrote: hi, I usually don't work with iui (iphone) but have some code and wanna adapt it to play with jquery. The problem is to attache events to the new generated DOM at each ajax request in iui (using jquery AJAX I would make a callback, but...). Finally discovered livequery but seems not to work this very very simple code in http://edit.csic.es/fitxers/gbifs/index.html : var example=function() {alert(clickiiin)}; $('li') .livequery('click',example); //each newly generated li should alert when clicking some help? thanks Pere Roca visita l'EDIT mapViewer! http://edit.csic.es/edit_geo/prototype/edit.html -- View this message in context: http://www.nabble.com/livequery-and-iui-tp19692949s27240p19692949.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Get parent url and add to a textarea
Ok. Your instance of jQuery is living in the parent window, so you need to reference it from inside the pop-up. Use this inside your pop-up code: script type=text/javascript $ = window.opener.$; $(window).load(function(){ $('#message',document).val(window.opener.location.href); }); /script Working on FF3 here - ricardo On Sep 26, 8:27 am, stinhambo [EMAIL PROTECTED] wrote: The HTML is - ul id=content_header_tools li id=tools_contact_usa href={path=contact-us/index}Contact Us/a/li li id=tools_email_pagea href={path=email-page/index} rel=email_pageEmail Page/a/li li id=tools_print_pagea href=javascript:window.print();Print Page/a/li /ul and this is part of what sits in my external file - $('a[rel=video_demo]').click(function(){ window.open(this.href,'mywindow','height=460,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=share_story], a[rel=video_story]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; On Sep 26, 10:31 am, ricardobeat [EMAIL PROTECTED] wrote: Now I'm completely lost. Could you post a test page? So where exactly is $(#message).get(0).value += window.opener.location.href; running? On Sep 25, 4:29 pm, stinhambo [EMAIL PROTECTED] wrote: Not at the moment. If I put it inside this - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); the popup comes up but the parent also loads the form and no URL gets carried across. On Sep 26, 2:46 am, ricardobeat [EMAIL PROTECTED] wrote: Is this line $(#message).get(0).value += window.opener.location.href; running from inside the popup? On Sep 25, 8:48 am, Stinhambo [EMAIL PROTECTED] wrote: I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] re[jQuery] place input value with user entered text
i have this set up: tdinput type=text value=0 //td users enter number in text field. .blur() I need to pass the entered value to the value attribute. I'm able to get the value of the number entered in the text box but I cannot seem to pass it to the value attribute of the input $('input').blur(function (){ var program = $(this).val(); any help in the correct direction would be great. thanks -- View this message in context: http://www.nabble.com/replace-input-value-with-user-entered-text-tp19694518s27240p19694518.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Reading XML elements with CDATA
Apologies if this has been asked before. I couldn't find any topics on this when I searched. I have some XML which looks like the following: ?xml version=1.0? response status1/status html![CDATA[ tr tdRow 1, Column 1/td tdRow 1, Column 2/td /tr tr tdRow 2, Column 1/td tdRow 2, Column 2/td /tr ]]/html /response I'd like to be able to read the html in javascript with something like this: $.post(test.xml, function(xml) { new_html = $(html, xml).text(); // Do something with the new html }); However if the XML element is using CDATA, $(html, xml).text() always returns the empty string. Is this a known issue? Is this a limitation of jQuery? Is there a workaround? Thanks, Russ
[jQuery] add a new class for middle element
Hello I really like this script. I was wondering , how would be possible to add a class to the middle element ?! I mean, by default there are always 3 elements, and i would like the middle one to be different (to add it some css style). Thanks.
[jQuery] Re: how to use Current of superfish
Hi Joel, finally i found time. a working example can be found under http://www.pbc-arnstorf.de/jquery/ Maybe it isnt working because we (you) changed the hover effect! I also now included the superfish-navbar.css which wasnt included by default. But it still doesn't work.
[jQuery] slide div height collapse
Hello, I'm new to jQuery and have been partial to mootools, but wanted to play with jQuery for a particular web project. One thing that I've noticed is the following: Using mootools slide effect http://www.hovara.com/ocl/ Using jQuery slide effect http://www.hovara.com/ocl/jqueryindex.php You will notice when clicking the login or register links, that the mootools is more fluid and the div heigh grows(pushes down) as the slide effect takes place, the jQuery example however sets the div height to what it knows it will eventually be and then performs the slide effect. I prefer the mootools look and was hoping to get some feedback as to whether this is part of the jquery core ui or a part of the specific jquery slide effect. As I will want to go about changing this. Thanks
[jQuery] Using :empty for blank divs
I've got the following in the head of my document: script type=text/javascript $(document).ready(function() { $(.bc-wrapper:empty).addClass(none); }); /script and in the body, div class=bottom-content div class=bc-wrapper /div!-- end bottom content wrapper -- /div The class that it's calling, none is simply a display: none from the stylesheet. So basically, if the div doesn't have any content in it, hide it. If it does have content, then it doesn't have any effect. Unfortunately, the div is still showing, and the only way that I've been able to actually get it to disappear is by testing the variables to target a table in the .bc-wrapper div. Did I misinterpret the documentation somehow?
[jQuery] Raising an event when a popup window is closing
I have a page with a popup that I want to raise an event for when the popup is being closed. Is there any event built-in to jQuery without any plugins that can be subscribed to for when a popup is closed? I can't seem to figure out any way to do this even without using jQuery. Is there any way to do something like this in jQuery?: var myWindow = window.open(/MyPopup.aspx, myWindow, height=550,width=780,top=100,left=100); $(myWindow).bind('close', function(){alert(Closed.)});
[jQuery] need help in making dynamic form validation
Hi everyone, I'm hoping someone can help me learn the right way to do this. Its experimental for me at this point. Example code is at the bottom. So what I'm attempting to do is to do input form validation by loading a function which self-assembles an object that has its properties set as the ID names of the inputs in a given form. The values of those inputs are then assigned as the values of those properties. In this way, you can pull all of the data in a form at once and iterate through the object to do your data checks, validation, etc. Since the properties correspond to the ID names, its easy to dynamically manipulate the DOM based on the structure of the object. In my example code below, I have a version that works correctly but it is commented out. It is setup so that the properties are predefined, then sets their values. It works, but its not the more dynamic self assembling one that I want. The second function that is not commented out was my (poor) attempt at building a working one. Basically, given a form ID, we loop through all inputs in the form and retrieves their IDs and values. The problem I have is that I don't know how to create new properties for the check function based on the IDs of the inputs. Thank you! script type=text/javascript $(document).ready(function(){ //standard method that works //check = function(){ //this.user = $('#user').attr('value'); //this.pass = $('#pass').attr('value'); //this.one = $('#one').attr('value'); //this.two = $('#two').attr('value'); //} //attempted jquery version check = function(){ $('#form1 :input').each(function(obj){ obj.$(this).attr('id') = $(this).attr('value'); }); } $('#clicker').click(function(){ c = new check(); alert( c.user+ | +c.pass+ | +c.one+ | +c.two ); }); }); /script form id=form1 h4user/h4 input type=input id=user/ h4pass/h4 input type=input id=pass/ h4one/h4 input type=input id=one/ h4two/h4 input type=input id=two/ /form input type=button id=clicker value=Click/
[jQuery] Re: Listen for location anchor change?
I've worked on a clean solution for this a while ago: http://haineault.com/blog/37/ The examples above might not be up to date since the code has changed a bit since then: http://code.google.com/p/jquery-utils/wiki/AnchorHandler Code: http://code.google.com/p/jquery-utils/source/browse/trunk/src/jquery.anchorHandler.js Cheers On Sep 24, 4:09 pm, mario [EMAIL PROTECTED] wrote: Hi, I was just wondering if there is anyway to listen for changes on the location bar when a link sets an anchor on the same page. Example: current location:www.something.com/ I click on a link and it takes me to: www.something.com/#someanchor Is there anyway to listen for this change/event with jquery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
I keep seeing people talking about different ways to access the document of an iframe. This method(after much hairpulling and testing) works very well. $('iframeID').contents() The .contents() method will automatically handle the browser differences between contentWindow and contentDocument. It will give you standard access to the iframe document no matter what browser. Further, if there are particular non-jQuery things you want to do in an iframe, its still a great way to do it. So for example, a problem I have been working on for several weeks involves adding a script into the iframe which itself calls another script for our forum system(Jive) that displays a list of comments. As a sidenote, the commenting system in Jive absolutely SUCKS. No caching, does document.writes, etc. The forum bit is really nice, but the comment system needs to be shot. So I am loading an iframe into the dom, then writing the script that loads the Jive comments into the iframe. When I was using the strict jQuery methods: $('#commentiframe').contents().find('body').html(scriptvar) It would write into the iframe, but it conflicted with some of the ads we serve on our site. Jive's comment widget does a bunch of document.write's into the document, and using the standard jQuery method the comments were being added to the page at the first occurrence of a script tag. Very, very wierd. So, the way I found around that was to drop back into normal javascript methods and came up with this: $('iframe id=commentiframe src='+scriptvar+'/ iframe').appendTo('body'); f=$('#commentiframe').contents()[0]; f.open(); f.write(scriptvar); f.close();
[jQuery] [Validate] Validation + Masked Input Issue
I've been using the validation plugin along with the masked input pluging and I am noticing a possible bug. When you have a textbox that has an input mask on it and click on the submit button it validates the field correctly, but then if you focus into the field and then leave it will mark the field as valid even though the field is still blank. I looked at the Marketo demo and the same behavior occurs there. Is there a workaround to get it to keep the field invalid after you go in and out of the textbox? Thanks, Jeff Papp
[jQuery] New Plugin - jMailer
Hi all, I've written a new plugin for jQuery called jMailer which creates a popup form for sending an email with. It's just the front-end, but should be compatible with a back-end of your choice. A demonstration (which has been mapped to a single email address to prevent misuse) can be seen at: www.danwellman.co.uk/jmailer/jMailerTest.html See the souce of the HTML for comments relating to usage I posted in the plugins mailing list but the post has not appeared, hence this post also. How do I get it on the plugins page of the jQuery site? Thanks
[jQuery] Re: suggestion - enable() / disable() functions
I actually *JUST* created enable disable functions: (function($) { /** * Disables the matched form elements, and adds the vardisabled/ var class * to them. * @return jQuery The matched elements. */ $.fn.disable = function() { $(this).each(function() { $(this).attr(disabled, true).addClass(disabled); }); // $(this).each() return $(this); }; // $.fn.disable() /** * Removes the vardisabled/var class from the matched form elements, and * re-enables them. * @return jQuery The matched elements. */ $.fn.enable = function() { $(this).each(function() { $(this).removeClass(disabled).attr(disabled, false); }); // $(this).each() return $(this); }; // $.fn.enable() })(jQuery); Enjoy! Jamie On Sep 26, 7:55 am, Martin [EMAIL PROTECTED] wrote: Dear all, I like jQuery much but I do not like the way the enabling, disabling elements is handled. This is a pretty common task and the current solution based on changing attributes is not in accord with jQuery’s “write less” philosophy. The enable() / disable() functions would be MUCH more elegant and in light with the jQuery gospel. Could this be included in the next release ? Best Martin
[jQuery] append empty string causes error
I'm not sure if this is correct behavior or a bug, but if I append an empty string it causes an error. So $('#someId').append('') causes an error. In my case, I'm actually supplying a variable to append() but this variable could be an empty string. I don't see why appending nothing would cause an error, which is why I think it's a bug. Anyway, for now, I'm just going to check if the variable is empty before calling append().
[jQuery] Re: i was patient, now i'm frustrated
John - There are quite a few of us who are big fans and have plenty of data center capacity. I am sure the community would be happy to mirror the site (you can have one of our small older server in our rack any time). Furthermore - RIMU hosting are great (I am a former client) if you need an app server, but for static content (as I think most of the jQuery site is) - EC2 may be better - and grin unlikely to suffer a power outage Cheers keep up the great work, Dejan On Sep 26, 8:46 am, John Resig [EMAIL PROTECTED] wrote: This is a completely unrelated issue - we host jQuery.com (the homepage, blog, and dev) on a separate server with Rimuhosting. There was a power outage at the server facility and they're working ot bring it back up:http://rimuhosting.com/maintenance.jsp?server_maint_oid=68009362 The other sub-domains should be responding fine (docs, plugins, ui, code). --John On Fri, Sep 26, 2008 at 4:35 AM, Richard W [EMAIL PROTECTED] wrote: How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] jQuery not working while loaded 2nd time in drupal
Hi, i am working in a site made with drupal . there i am using ajax through jQuery for a polling options. the first time code runs nice ... as soon as some one submit one vote the poll section is loaded with the new result. now nothing works in that section. i am having these two major issues : 1) if i comment out the $(document).ready ... line it doesnt work , even for the first time 2) as soon as the ajax is getting called i see two responses in firebug .. one using POST method (in my code i have used this ) and another using the GET method . The code is as follows: $(document).ready(function(){ $([EMAIL PROTECTED]'edit-vote']).click(function(){ var posted_vote = $('[EMAIL PROTECTED]'choice\']:checked').val(); if(posted_vote == null) { alert('You must have to enter one choice first. Please check one of the checkboxes.'); $('[EMAIL PROTECTED]'choice\']').addClass('form-text required error'); return false; } else { var form_nid = $('#edit-current-nid').val(); $(#div_poll).animate({opacity: 0.7}, 1500 ); $('#div_poll').html(loading_msg); $.ajax({ type: post, url: req_path + node/ + form_nid + /ajax_poll, data: choice= + posted_vote + op=Vote + nid= + form_nid, success: function(msg){ $(#div_poll).animate({opacity: 1}, 1500 ); $('#div_poll').text(msg); }, error: function (xmlhttp) { alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ uri); } }); } }); }); any clue ?
[jQuery] Re: append empty string causes error
I'd guess it was something else, as this code works just fine, no errors http://paste.pocoo.org/show/86303/ If appending or null was an issue, 'Bob' would never get shown On Sep 26, 3:15 pm, kape [EMAIL PROTECTED] wrote: I'm not sure if this is correct behavior or a bug, but if I append an empty string it causes an error. So $('#someId').append('') causes an error. In my case, I'm actually supplying a variable to append() but this variable could be an empty string. I don't see why appending nothing would cause an error, which is why I think it's a bug. Anyway, for now, I'm just going to check if the variable is empty before calling append().
[jQuery] Re: add a new class for middle element
HTML: div class=some-class pFirst element/p pSecond element/p pThird element/p /div jQuery: $('.some-class p:eq(1)' ).css('color', 'red'); -- jQuery pseudo-class :eq(i) targets the i-nd occurence of the obeject selected. Counts start on zero (JavaScript based) Argument i can be a math expression like: ($('p').size() - 1)/2) // founds the middle of a odd number of paragraphs Maujor -Mensagem Original- De: gepa [EMAIL PROTECTED] Para: jQuery (English) jquery-en@googlegroups.com Enviada em: sexta-feira, 26 de setembro de 2008 11:44 Assunto: [jQuery] add a new class for middle element Hello I really like this script. I was wondering , how would be possible to add a class to the middle element ?! I mean, by default there are always 3 elements, and i would like the middle one to be different (to add it some css style). Thanks.
[jQuery] Re: how do you toggle a checkbox value?
I would recommend using the attr() method of jquery like: checkbox.attr('checked') = !checkbox.attr('checked') On Sep 26, 12:01 pm, chris [EMAIL PROTECTED] wrote: I know there is a quirk with checkboxes, but I am under the impression that setting the check state to boolean values within javascript takes care of that. Unfortunately, this assumption is proving to be an incorrect one. // Here is a snippet of code $(li# + liId).click(function(event){ var checkbox = $(# + checkboxId) // this is being found as expected // flip the checkbox state console.log(checkbox.checked) checkbox.checked = !checkbox.checked == End // This code snippet always returns Undefined even when the checkbox is checked console.log(checkbox.checked) // which then makes the flip of the values not work checkbox.checked = !checkbox.checked What is the proper way to reference the checked value and flip the value? Thanks.
[jQuery] Re: jEditable Clone Referring to the Original Element, livequery ok to use?
I was trying to put livequery in place on the site, but it seems to attach to pre-known events, like click, instead of new events, like editable. For instance, I'm trying to do this: $(.editable, .bline_measure caption).livequery(editable, function(value, settings) { Wanting to watch these items and rebind editable to the newly created captions when I clone them. Is this not a good job for livequery? -Wayne On Sep 22, 9:06 am, Wayne [EMAIL PROTECTED] wrote: Thanks, Mike. This info helps. Great work, btw. -Wayne On Sep 20, 12:22 pm, Mika Tuupola [EMAIL PROTECTED] wrote: On Sep 19, 2008, at 6:20 PM, Wayne wrote: In short, I can clone jEditable items, but I can't edit them in place without a page reload and rewriting from the server side. Am I ignoring something or do I need to reset a binding somewhere when I do the DOM modification? This should help: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st... basically you need to rebind events to cloned elements. -- Mika Tuupolahttp://www.appelsiini.net/
[jQuery] Re: how do you toggle a checkbox value?
var checkbox = $(# + checkboxId) // this is being found as expected The part you are missing is that checkbox is a jQuery object, not a checkbox DOM object so: checkbox.checked sure would error because there is no .checked property of a jQuery object so: checkbox[0].checked would work since the first item on a jQuery array is the DOM object itself make sense? On Sep 26, 1:01 pm, chris [EMAIL PROTECTED] wrote: I know there is a quirk with checkboxes, but I am under the impression that setting the check state to boolean values within javascript takes care of that. Unfortunately, this assumption is proving to be an incorrect one. // Here is a snippet of code $(li# + liId).click(function(event){ var checkbox = $(# + checkboxId) // this is being found as expected // flip the checkbox state console.log(checkbox.checked) checkbox.checked = !checkbox.checked == End // This code snippet always returns Undefined even when the checkbox is checked console.log(checkbox.checked) // which then makes the flip of the values not work checkbox.checked = !checkbox.checked What is the proper way to reference the checked value and flip the value? Thanks.
[jQuery] jQuery and Zend Framework validation integration
Hi all, I am going to use server-side Zend_Form data validation process and its result show with jQuery. I send form data via ajaxForm(); function and Zend controller validates data a returns information about validation result in json format: {status:error,messages:{email:{isEmpty:Value is empty, but a non-empty value is required},password:{isEmpty:Value is empty, but a non-empty value is required},password2:{isEmpty:Value is empty, but a non-empty value is required},city:{isEmpty:Value is empty, but a non-empty value is required},zip:{isEmpty:Value is empty, but a non-empty value is required},street:{isEmpty:Value is empty, but a non-empty value is required}}} Do anybody know how to parse it a how to display these messages in proper form error labels? Thank you, J.
[jQuery] [validate] jQuery validation plugin in Drupal
Hi, When trying to use the validator plugin, I get the following error: missing : after property id edit-name: required, It seems like it has problems with the - that Drupal puts in the id's of each form field. Is there a workaround possible? Thanks, Jeroen Coumans
[jQuery] Re: [validate] Get form validation state without triggering errors
You can call an internal API method, that should give you the desired result, though its subject to change in future versions. Let me know if it works for you! var validator = $(#myForm).validate(); // to check, call validator.checkForm(); Jörn On Thu, Sep 25, 2008 at 7:36 PM, dl [EMAIL PROTECTED] wrote: I'm trying to check if a form has been filled out properly before enabling the Next button. Unfotunately, when I call the method jQuery(#myForm).valid() the error messages are all triggered. I want the error message in there because I want the user to be able click the disabled next button and see what the specific problems are, but I want the next button to be a visible indicator of when the form is ready to go. Is it possible to silently get the validation state of the form?
[jQuery] Re: treeview
Random errors in IE6 can be caused by the packed version of jQuery. Try to use minified(+gzip) to get around that. Treeview works best with small trees. How big is your menu? I can't find it on the URL you provided. Jörn On Fri, Sep 26, 2008 at 2:21 PM, bdct [EMAIL PROTECTED] wrote: Hello i hope someone can help this is driving me mad. Im using jquery-1.2.6.pack.js jquery-treeview.js jquery-cookie.js for a menu on www.bdct.nhs.uk everything works ok apart from in ie6 where some of the links disappear. but even this is inconsistent on different machines with ie6 installed. Can any one help? Also refreshing the page takes a long time is that because of the cookies? is there any way to speed this up? Cheers bdct
[jQuery] Re: [Validate] Validation + Masked Input Issue
Could you file a ticket for this? http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Fri, Sep 26, 2008 at 6:30 PM, Jeff Papp [EMAIL PROTECTED] wrote: I've been using the validation plugin along with the masked input pluging and I am noticing a possible bug. When you have a textbox that has an input mask on it and click on the submit button it validates the field correctly, but then if you focus into the field and then leave it will mark the field as valid even though the field is still blank. I looked at the Marketo demo and the same behavior occurs there. Is there a workaround to get it to keep the field invalid after you go in and out of the textbox? Thanks, Jeff Papp
[jQuery] Re: jQuery and Zend Framework validation integration
Setup ajaxForm with dataType:json. Then your success-callback will get a parsed JavaScript object as the first argument. $(#myform).ajaxForm({ dataType: json, success: function(data) { // iterate over data.messages and display labels? } }); Jörn On Fri, Sep 26, 2008 at 11:56 PM, jnemec [EMAIL PROTECTED] wrote: Hi all, I am going to use server-side Zend_Form data validation process and its result show with jQuery. I send form data via ajaxForm(); function and Zend controller validates data a returns information about validation result in json format: {status:error,messages:{email:{isEmpty:Value is empty, but a non-empty value is required},password:{isEmpty:Value is empty, but a non-empty value is required},password2:{isEmpty:Value is empty, but a non-empty value is required},city:{isEmpty:Value is empty, but a non-empty value is required},zip:{isEmpty:Value is empty, but a non-empty value is required},street:{isEmpty:Value is empty, but a non-empty value is required}}} Do anybody know how to parse it a how to display these messages in proper form error labels? Thank you, J.
[jQuery] Re: [validate] jQuery validation plugin in Drupal
Yes, details can be found here: http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_complex_names_.28brackets.2C_dots.29 Jörn On Sat, Sep 27, 2008 at 2:34 AM, Jeroen Coumans [EMAIL PROTECTED] wrote: Hi, When trying to use the validator plugin, I get the following error: missing : after property id edit-name: required, It seems like it has problems with the - that Drupal puts in the id's of each form field. Is there a workaround possible? Thanks, Jeroen Coumans
[jQuery] Re: need help in making dynamic form validation
Give the validation plugin a try instead: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ Just call $(#form1).validate(); and add a few classes to your form elements, eg. class=required for required fields, or email etc. A list of available methods is here: http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods Jörn On Fri, Sep 26, 2008 at 8:11 PM, Geuis [EMAIL PROTECTED] wrote: Hi everyone, I'm hoping someone can help me learn the right way to do this. Its experimental for me at this point. Example code is at the bottom. So what I'm attempting to do is to do input form validation by loading a function which self-assembles an object that has its properties set as the ID names of the inputs in a given form. The values of those inputs are then assigned as the values of those properties. In this way, you can pull all of the data in a form at once and iterate through the object to do your data checks, validation, etc. Since the properties correspond to the ID names, its easy to dynamically manipulate the DOM based on the structure of the object. In my example code below, I have a version that works correctly but it is commented out. It is setup so that the properties are predefined, then sets their values. It works, but its not the more dynamic self assembling one that I want. The second function that is not commented out was my (poor) attempt at building a working one. Basically, given a form ID, we loop through all inputs in the form and retrieves their IDs and values. The problem I have is that I don't know how to create new properties for the check function based on the IDs of the inputs. Thank you! script type=text/javascript $(document).ready(function(){ //standard method that works //check = function(){ //this.user = $('#user').attr('value'); //this.pass = $('#pass').attr('value'); //this.one = $('#one').attr('value'); //this.two = $('#two').attr('value'); //} //attempted jquery version check = function(){ $('#form1 :input').each(function(obj){ obj.$(this).attr('id') = $(this).attr('value'); }); } $('#clicker').click(function(){ c = new check(); alert( c.user+ | +c.pass+ | +c.one+ | +c.two ); }); }); /script form id=form1 h4user/h4 input type=input id=user/ h4pass/h4 input type=input id=pass/ h4one/h4 input type=input id=one/ h4two/h4 input type=input id=two/ /form input type=button id=clicker value=Click/
[jQuery] Re: Tabs with multiple CSS classes
Thank you kindly sir, that did exacly what I wanted. I only had to use the navClass: 'my-ui-tabs-nav' option. Is looking at the noncompressed code the best way to figure that stuff out with out having to ask? On 9/26/08, Klaus Hartl [EMAIL PROTECTED] wrote: You can change the class names via options (undocumented): $('#foo').tabs({ navClass: 'my-ui-tabs-nav' selectedClass: 'my-ui-tabs-selected', disabledClass: 'my ui-tabs-disabled', panelClass: 'my-ui-tabs-panel', loadingClass: 'my-ui-tabs-loading' }); Although I prefer to style different tabs on one page via context: .ui-tabs-nav { /* shared */ } #one .ui-tabs-nav { /* additional styles for the first tab interface */ } #two .ui-tabs-nav { /* additional styles for second tab interface */ } Or if you apply the id directly to the ul element: #one.ui-tabs-nav { /* additional styles for the first tab interface */ } --Klaus On 25 Sep., 17:04, Dan B. [EMAIL PROTECTED] wrote: Hi Folks, I'm interested in having multiple instances of tabs on a page/pages throughout a site and on the same page without using an iFrame. The tabs function is cool. I'd like to pass it a different base class, so that basically I have tab controls of different styles on the same page. Specifically I'm wanting to have this set of tabs have different widths; I'm looking for like a base-class option to pass to jquery.tabs or something. Any suggestions? dan
[jQuery] Re: Raising an event when a popup window is closing
Use the unload event: $(myWindow).bind('unload', function(){alert(Closed.)}); - ricardo On Sep 26, 11:52 am, Dan [EMAIL PROTECTED] wrote: I have a page with a popup that I want to raise an event for when the popup is being closed. Is there any event built-in to jQuery without any plugins that can be subscribed to for when a popup is closed? I can't seem to figure out any way to do this even without using jQuery. Is there any way to do something like this in jQuery?: var myWindow = window.open(/MyPopup.aspx, myWindow, height=550,width=780,top=100,left=100); $(myWindow).bind('close', function(){alert(Closed.)});
[jQuery] Re: Can jQuery do it again and again?
I think this is the most appropiate response for this recurrent question: http://docs.jquery.com/FAQ#Why_do_my_events_stop_working_after_an_Ajax_request.3F -- Ariel Flesler http://flesler.blogspot.com/ On Sep 26, 3:17 pm, thelemondropkid [EMAIL PROTECTED] wrote: Thanks to the help I have received on this group, I am making progress. But now that all is working fine, the question beckons: Can jQuery do it all over again? This is my code: div class=box h3some header/h3 img name=Image src=photo.jpg width=268 height=122 alt= / pLorem ipsum dolor sit amet./p /div And the jQuery: $(document).ready(function(){ $(div.box *).wrapAll('div class=inside/div'); $(div.box).append('div class=tl/div'+'div class=tr/ div'+'div class=bl/div'+'div class=br/div'); }); The problem: I would have thought that jQuery would repeat the above process if I created another div with a class of box below the previous one. I was wrong! Is there a way to do that because I would like to create various boxes with a class of box and have them all look the same. Thanks folks