[jQuery] Re: Test - please ignore
no, I will acknowledge! anoop wrote: Test - please ignore
[jQuery] Re: Test - please ignore
Thanks - but if you really should, then please acknowledge my actual posts: http://groups.google.com/group/jquery-en/browse_thread/thread/130b4df144c2e0b9 I would much appreciate any help you could provide.. :-) -Anoop On Fri, Jul 24, 2009 at 12:26 PM, Liam Potter radioactiv...@gmail.comwrote: no, I will acknowledge! anoop wrote: Test - please ignore
[jQuery] Re: test - sorry, ignore -- why can't I see my posts....
On Mon, Apr 20, 2009 at 6:21 PM, kali maya778...@yahoo.com wrote: I can't see any posts I post to this group, why is this, WHY is it at all that you only read this forum if you're logged on to google?? most forums online you just need to register with the forum.. WHY bring google in um ... because it's google's forum. What's the difference between logging into some other forum and google groups? Nothing really. either way, even after logging on to my google acct I can't see my posts (they get emailed to me if I check send me a copy, but I don't see the posts here http://groups.google.com/group/jquery-en/topics?gvc=2 It seems that one's own posts are filtered from the view. This confused me too at first. I only see my posts show up when someone responds.
[jQuery] Re: test for .is(:visible) fails in Safari
Ricardo, Thanks so much for responding. That's very helpful. My use of events has been very rudimentary so far; your .bind() example has helped me understand them more fully. And now that I know what I'm looking for, various approaches to the problem have been illuminating as well. for example ajp's recent thread:: http://osdir.com/ml/jquery-dev/2009-02/msg00615.html On Sat, 14 Mar 2009, ricardobeat wrote: Try this: el.find(#pic) .attr({src: pix[imgName].imgSrc, name: imgName}) .bind('load readystatechange', function(e){ if (this.complete || (this.readyState == 'complete' e.type = 'readystatechange')) { el.fadeIn(slow); $(#loading).hide(); }; }); The onload event for images is a cross-browser mess. - ricardo
[jQuery] Re: test for .is(:visible) fails in Safari
Dear all, OK, solved it myself in case anyone's still listening. It still remains a puzzle why safari on Mac interprets the code differently. The if/else test below isn't necessary. The fadeOut was executing, but the .load() callback failed when the .thumb clicked was the same one as the previous click. Both FF and IE didn't blink when the src of #pic remained the same, but safari wouldn't execute the .load callback because nothing loaded: the src of #pic remained the same. The solution for my purposes was to set the src of #pic to null and then re-set it to pix[imgName].imgSrc whatever it might be, then .load() sees that something has loaded and executes the callback. Is this a known discrepancy between how FF, IE, and Safari interpret .load(), or something completely screwy and idiosyncratic to my klugy code? (jQuery 1.2.6, by the way, in safari 3.1.2) Jon On Fri, 13 Mar 2009, Jon Crump wrote: Dear all, I'm not sure if this is a jQuery question or not, but I got the following code to work in FF, but it fails in Safari: $(.thumb).click(function() { var imgName = $(this).attr(alt); var el = $(#dropdown); if (el.is(:visible) $(#pic).attr(name) == imgName) return; else { el.fadeOut(slow, function() { $(#loading).show(); el.find(#textContent) .text(pix[imgName].aText); el.find(#pic) .attr({src: pix[imgName].imgSrc, name: imgName}) .load(function(){ el.fadeIn(slow); $(#loading).hide(); }); }); } }); The if/else test was necessitated by the fact that if the user clicked on the same thumbnail image twice, the #dropdown element faded out and didn't fade back in. In FF clicking on the same image twice makes no change, but in Safari, clicking on the same image twice makes no change IF #dropdown is visible, if #dropdown is NOT visible and the user clicks on the same thumbnail that was last clicked on, the loading gif displays but the #dropdown does not. I'm sure this is just my own javascript inexperience, but can anyone suggest where I'm going wrong? Thanks, Jon
[jQuery] Re: test for .is(:visible) fails in Safari
Try this: el.find(#pic) .attr({src: pix[imgName].imgSrc, name: imgName}) .bind('load readystatechange', function(e){ if (this.complete || (this.readyState == 'complete' e.type = 'readystatechange')) { el.fadeIn(slow); $(#loading).hide(); }; }); The onload event for images is a cross-browser mess. - ricardo On Mar 14, 7:27 pm, Jon Crump jjcr...@myuw.net wrote: Dear all, OK, solved it myself in case anyone's still listening. It still remains a puzzle why safari on Mac interprets the code differently. The if/else test below isn't necessary. The fadeOut was executing, but the .load() callback failed when the .thumb clicked was the same one as the previous click. Both FF and IE didn't blink when the src of #pic remained the same, but safari wouldn't execute the .load callback because nothing loaded: the src of #pic remained the same. The solution for my purposes was to set the src of #pic to null and then re-set it to pix[imgName].imgSrc whatever it might be, then .load() sees that something has loaded and executes the callback. Is this a known discrepancy between how FF, IE, and Safari interpret .load(), or something completely screwy and idiosyncratic to my klugy code? (jQuery 1.2.6, by the way, in safari 3.1.2) Jon On Fri, 13 Mar 2009, Jon Crump wrote: Dear all, I'm not sure if this is a jQuery question or not, but I got the following code to work in FF, but it fails in Safari: $(.thumb).click(function() { var imgName = $(this).attr(alt); var el = $(#dropdown); if (el.is(:visible) $(#pic).attr(name) == imgName) return; else { el.fadeOut(slow, function() { $(#loading).show(); el.find(#textContent) .text(pix[imgName].aText); el.find(#pic) .attr({src: pix[imgName].imgSrc, name: imgName}) .load(function(){ el.fadeIn(slow); $(#loading).hide(); }); }); } }); The if/else test was necessitated by the fact that if the user clicked on the same thumbnail image twice, the #dropdown element faded out and didn't fade back in. In FF clicking on the same image twice makes no change, but in Safari, clicking on the same image twice makes no change IF #dropdown is visible, if #dropdown is NOT visible and the user clicks on the same thumbnail that was last clicked on, the loading gif displays but the #dropdown does not. I'm sure this is just my own javascript inexperience, but can anyone suggest where I'm going wrong? Thanks, Jon
[jQuery] Re: test for css selector capability?
Hi, I realize that jQuery.browser is now deprecated, but I'd like to give a use case where it makes sense to use jQuery.browser: I have some code where each browser renders slightly differently, such as how they treat borders for DIVs. If I use jQuery.browser, I can update the CSS appropriately for the quirky browsers. If jQuery.browser is eliminated in the future, I still need to detect rendering quirks. This isn't about whether a browser supports a particular CSS or JavaScript feature, but instead it involves subtle but important differences in the rendering engines for the four major browsers: WebKit (Safari/Chrome), Gecko (Firefox), Trident (IE) and Presto (Opera). Cheers, Greg. On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browseris deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi Geuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM, Geuis geuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
Hi Geuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this *$.browser.mozilla , $.browser.msie , ** $.browser.opera , $.browser.safari.* if u wana return the version of browser , then u have use below function *$.browser.version *it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM, Geuis geuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details... http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi Geuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM, Geuis geuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
Are you *sure* that parent child doesn't work in IE6? I could see that this CSS declaration, and pretty sure it doesn't work ul li { color: blue; } but part of the magic of jQuery (and other libraries) is that it takes that into account already. and saying $(ul li) should work no matter what (supported) browser it runs on On Feb 9, 5:33 pm, Geuis geuis.te...@gmail.com wrote: I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
I guess this really is a hard concept to get across after all. Ok, so there's browser feature detection with .support. So imagine the thing I'm talking about works like this: alert( $('ul li:first-child').support ); alerts 'true' if Firefox, but alerts 'false' if IE6. I'm not trying use the selectors to do styling, I'm trying to use the selectors to detect browser capability. On Feb 9, 2:50 pm, MorningZ morni...@gmail.com wrote: Are you *sure* that parent child doesn't work in IE6? I could see that this CSS declaration, and pretty sure it doesn't work ul li { color: blue; } but part of the magic of jQuery (and other libraries) is that it takes that into account already. and saying $(ul li) should work no matter what (supported) browser it runs on On Feb 9, 5:33 pm,Geuisgeuis.te...@gmail.com wrote: I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
You could do this because the .css(attribute) returns the computed (the result of all the CSS applied) value of an element's CSS attribute. It would involve adding a stylesheet to the document with the particular selector in it, with say a change to the background colour. Then create elements that should be selected (and add them to the document), then test the .css('background-color') of the element to see if it matches the colour in the stylesheet. Slightly tricky but doable. Karl Rudd On Tue, Feb 10, 2009 at 10:31 AM, Geuis geuis.te...@gmail.com wrote: I guess this really is a hard concept to get across after all. Ok, so there's browser feature detection with .support. So imagine the thing I'm talking about works like this: alert( $('ul li:first-child').support ); alerts 'true' if Firefox, but alerts 'false' if IE6. I'm not trying use the selectors to do styling, I'm trying to use the selectors to detect browser capability. On Feb 9, 2:50 pm, MorningZ morni...@gmail.com wrote: Are you *sure* that parent child doesn't work in IE6? I could see that this CSS declaration, and pretty sure it doesn't work ul li { color: blue; } but part of the magic of jQuery (and other libraries) is that it takes that into account already. and saying $(ul li) should work no matter what (supported) browser it runs on On Feb 9, 5:33 pm,Geuisgeuis.te...@gmail.com wrote: I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: test for css selector capability?
Ahh, that's a great point! Thanks Karl, I think you solved my problem! On Feb 9, 4:06 pm, Karl Rudd karl.r...@gmail.com wrote: You could do this because the .css(attribute) returns the computed (the result of all the CSS applied) value of an element's CSS attribute. It would involve adding a stylesheet to the document with the particular selector in it, with say a change to the background colour. Then create elements that should be selected (and add them to the document), then test the .css('background-color') of the element to see if it matches the colour in the stylesheet. Slightly tricky but doable. Karl Rudd On Tue, Feb 10, 2009 at 10:31 AM,Geuisgeuis.te...@gmail.com wrote: I guess this really is a hard concept to get across after all. Ok, so there's browser feature detection with .support. So imagine the thing I'm talking about works like this: alert( $('ul li:first-child').support ); alerts 'true' if Firefox, but alerts 'false' if IE6. I'm not trying use the selectors to do styling, I'm trying to use the selectors to detect browser capability. On Feb 9, 2:50 pm, MorningZ morni...@gmail.com wrote: Are you *sure* that parent child doesn't work in IE6? I could see that this CSS declaration, and pretty sure it doesn't work ul li { color: blue; } but part of the magic of jQuery (and other libraries) is that it takes that into account already. and saying $(ul li) should work no matter what (supported) browser it runs on On Feb 9, 5:33 pm,Geuisgeuis.te...@gmail.com wrote: I think my question was misunderstood. I'm not asking about detecting browser versions. I want to test if the current browser has native support for a particular kind of CSS selector. My previous example was the :first- child pseudo selector that isn't supported in IE6, but is supported in most other browsers. Another example would be ul li, which selects only li elements that are immediate children of a ul. Anyone have some ideas on how this could be implemented? On Feb 9, 7:16 am, Aaron Gundel aaron.gun...@gmail.com wrote: jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details...http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: HiGeuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM,Geuisgeuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: Test if BlockUI is blocking an element
Is there a way to test if blockUI is currently blocking a specific element? You can check to see if there is a block on a specific element like this: var isBlocked = $('#elementId').data('blockUI.isBlocked');
[jQuery] Re: Test if a variable is a jQuery object?
I'm trying to grasp the concept of need for this check What's a situation where you would wonder what it is? Are you not in control of your own code or something? On Jan 5, 3:53 pm, Andy Matthews amatth...@dealerskins.com wrote: How can I test to see if something is a jQuery object, or a normal JavaScript object? andy
[jQuery] Re: Test if a variable is a jQuery object?
This sort of thing can happen a lot if you're writing functions which take multiple inputs, based on convenience. Being in control of your code shouldn't be a fascist thing like you're describing, where there's only one way in which everything can or should happen. Having openness in parameters is always a good thing. And with that, you'll want to use instanceof to solve the problem. var someObj = document.getElementById('div1'), otherObj = $('div id=div2/div'), thirdObj = {}; if (someObj instanceof jQuery); // false if (otherObj instanceof jQuery); // true if (thirdObj instanceof jQuery); // false Whereas all options return object in a typeof check, instanceof allows you to compare an object with an instantiation object, like jQuery. On Jan 5, 3:57 pm, MorningZ morni...@gmail.com wrote: I'm trying to grasp the concept of need for this check What's a situation where you would wonder what it is? Are you not in control of your own code or something? On Jan 5, 3:53 pm, Andy Matthews amatth...@dealerskins.com wrote: How can I test to see if something is a jQuery object, or a normal JavaScript object? andy
[jQuery] Re: Test if a variable is a jQuery object?
I am, but I'm using a function containing some jQuery code in conjunction with a few existing Dreamweaver methods. My code passes in a pure jQ object, whereas the jQuery code passes in a string. Inside the method I was going to text for which was which then take some additional action for the string. I ended up just testing for string. function expandDiv(myVar) { // if the MM_jumpMenu method is calling, it passes in a string if (typeof myVar == 'string') { // do stuff } else { var $obj = $(myVar); } $('.hidden').hide('fast'); $obj.show('fast'); } -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Monday, January 05, 2009 2:57 PM To: jQuery (English) Subject: [jQuery] Re: Test if a variable is a jQuery object? I'm trying to grasp the concept of need for this check What's a situation where you would wonder what it is? Are you not in control of your own code or something? On Jan 5, 3:53 pm, Andy Matthews amatth...@dealerskins.com wrote: How can I test to see if something is a jQuery object, or a normal JavaScript object? andy
[jQuery] Re: Test if a variable is a jQuery object?
There're different ways: obj instanceof jQuery obj obj.constructor == jQuery obj obj.jquery And any other possible attribute sniffing, 'jquery' is obviously the safest. -- Ariel Flesler http://flesler.blogspot.com On Jan 5, 7:08 pm, Eric Garside gars...@gmail.com wrote: This sort of thing can happen a lot if you're writing functions which take multiple inputs, based on convenience. Being in control of your code shouldn't be a fascist thing like you're describing, where there's only one way in which everything can or should happen. Having openness in parameters is always a good thing. And with that, you'll want to use instanceof to solve the problem. var someObj = document.getElementById('div1'), otherObj = $('div id=div2/div'), thirdObj = {}; if (someObj instanceof jQuery); // false if (otherObj instanceof jQuery); // true if (thirdObj instanceof jQuery); // false Whereas all options return object in a typeof check, instanceof allows you to compare an object with an instantiation object, like jQuery. On Jan 5, 3:57 pm, MorningZ morni...@gmail.com wrote: I'm trying to grasp the concept of need for this check What's a situation where you would wonder what it is? Are you not in control of your own code or something? On Jan 5, 3:53 pm, Andy Matthews amatth...@dealerskins.com wrote: How can I test to see if something is a jQuery object, or a normal JavaScript object? andy
[jQuery] Re: Test that at least one input element has value
I just did something similar to your sollution but ended up in the same problem (duplicating the error-message). Did you already found the sollution to it?! On 3 nov, 09:55, Torgeir [EMAIL PROTECTED] wrote: Yes, I need to do somewhat the same thing as the groups option does, but the problem is that I have 20 - 30 products and I would like to add/remove products without having to update the validation each time. Here's what the docs say about the groups option: A group consists of an arbitrary group name as the key and a space separated list of element names as the value. I guess I'm looking for a more general and expandable way to do this... On Oct 30, 7:35 pm, w1ntermut3 [EMAIL PROTECTED] wrote: If I understand you right, I think you need the groups option: $(#myform).validate({ groups: { username: product1 product2 } }); AFAIK, that'll group error messages for your selected elements.
[jQuery] Re: Test that at least one input element has value
Yes, I need to do somewhat the same thing as the groups option does, but the problem is that I have 20 - 30 products and I would like to add/remove products without having to update the validation each time. Here's what the docs say about the groups option: A group consists of an arbitrary group name as the key and a space separated list of element names as the value. I guess I'm looking for a more general and expandable way to do this... On Oct 30, 7:35 pm, w1ntermut3 [EMAIL PROTECTED] wrote: If I understand you right, I think you need the groups option: $(#myform).validate({ groups: { username: product1 product2 } }); AFAIK, that'll group error messages for your selected elements.
[jQuery] Re: Test that at least one input element has value
If I understand you right, I think you need the groups option: $(#myform).validate({ groups: { username: product1 product2 } }); AFAIK, that'll group error messages for your selected elements.
[jQuery] Re: Test if jquery has loaded
It's not a case of the alert not showing up. That would result in an error halting all processing. So for a human sitting at the screen that would give us the data he wanted. But for code that needs to do something differently if jQuery were not loaded, the alert method would just fail and the alternate code would never fire. Of course, it comes down to what the coder really wants. He/she now has two options. Shawn Kyle Browning wrote: Of course it would fail if the function didnt exist. Thats the point. He wanted to know how to check if it was loaded or not, so If the alert doesnt show up, its not loaded. On Feb 6, 2008 11:48 PM, Shawn [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That would fail if jQuery hasn't loaded. It would give an error saying something like $ has no properties, or $ is not a function. You could try something like this: if (jQuery) { alert(jQuery loaded); } I haven't tested this but don't see why it wouldn't work... HTH Shawn Kyle Browning wrote: $(document).ready(function() { alert('hi'); }); This uses jQuery's .ready function on the document object On Feb 6, 2008 2:41 PM, MikeeBee [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Is there a small piece of code you can put on a page to test if jquery has loaded? Thanks
[jQuery] Re: Test if jquery has loaded
That would fail if jQuery hasn't loaded. It would give an error saying something like $ has no properties, or $ is not a function. You could try something like this: if (jQuery) { alert(jQuery loaded); } I haven't tested this but don't see why it wouldn't work... HTH Shawn Kyle Browning wrote: $(document).ready(function() { alert('hi'); }); This uses jQuery's .ready function on the document object On Feb 6, 2008 2:41 PM, MikeeBee [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Is there a small piece of code you can put on a page to test if jquery has loaded? Thanks
[jQuery] Re: Test if jquery has loaded
Of course it would fail if the function didnt exist. Thats the point. He wanted to know how to check if it was loaded or not, so If the alert doesnt show up, its not loaded. On Feb 6, 2008 11:48 PM, Shawn [EMAIL PROTECTED] wrote: That would fail if jQuery hasn't loaded. It would give an error saying something like $ has no properties, or $ is not a function. You could try something like this: if (jQuery) { alert(jQuery loaded); } I haven't tested this but don't see why it wouldn't work... HTH Shawn Kyle Browning wrote: $(document).ready(function() { alert('hi'); }); This uses jQuery's .ready function on the document object On Feb 6, 2008 2:41 PM, MikeeBee [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Is there a small piece of code you can put on a page to test if jquery has loaded? Thanks
[jQuery] Re: Test if jquery has loaded
On Feb 6, 2008, at 5:41 PM, MikeeBee wrote: Is there a small piece of code you can put on a page to test if jquery has loaded? Thanks Sure. You could do this: if (typeof jQuery != 'undefined') { // do something } --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Test if jquery has loaded
$(document).ready(function() { alert('hi'); }); This uses jQuery's .ready function on the document object On Feb 6, 2008 2:41 PM, MikeeBee [EMAIL PROTECTED] wrote: Is there a small piece of code you can put on a page to test if jquery has loaded? Thanks
[jQuery] Re: Test if object is jQuery object
On 30 Okt., 17:55, Josh Nathanson [EMAIL PROTECTED] wrote: Is there a cool way to check if an object is a jQuery object as opposed to any other object? I tried the constructor property but it just says Object(), the same as any other object. Tried typeof, but same deal, just object. Right now my function can take an object or a jQuery object as an argument, and all I've figured out is that the jQuery object is indexable (array-like), so if the object is not jQuery it will return undefined if I say obj[0]. But, this seems like a hack - is there a better way to test the object's type? -- Josh Try: var isJQuery = obj instanceof jQuery; --Klaus
[jQuery] Re: Test if object is jQuery object
var isJQuery = obj instanceof jQuery; Thanks Klaus and Yehuda, I think I like this better than just checking if there is a property 'jquery' on the object. That would work too, but 'instanceof' is exactly what I'm checking for. -- Josh - Original Message - From: Klaus Hartl [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, October 31, 2007 3:06 AM Subject: [jQuery] Re: Test if object is jQuery object On 30 Okt., 17:55, Josh Nathanson [EMAIL PROTECTED] wrote: Is there a cool way to check if an object is a jQuery object as opposed to any other object? I tried the constructor property but it just says Object(), the same as any other object. Tried typeof, but same deal, just object. Right now my function can take an object or a jQuery object as an argument, and all I've figured out is that the jQuery object is indexable (array-like), so if the object is not jQuery it will return undefined if I say obj[0]. But, this seems like a hack - is there a better way to test the object's type? -- Josh Try: var isJQuery = obj instanceof jQuery; --Klaus
[jQuery] Re: Test if object is jQuery object
Try ... if(Object.jquery){ ; // it's (probably) a jQuery object }else{ ; // it's not } On Oct 30, 4:55 pm, Josh Nathanson [EMAIL PROTECTED] wrote: Is there a cool way to check if an object is a jQuery object as opposed to any other object? I tried the constructor property but it just says Object(), the same as any other object. Tried typeof, but same deal, just object. Right now my function can take an object or a jQuery object as an argument, and all I've figured out is that the jQuery object is indexable (array-like), so if the object is not jQuery it will return undefined if I say obj[0]. But, this seems like a hack - is there a better way to test the object's type? -- Josh
[jQuery] Re: Test if object is jQuery object
On Oct 30, 9:55 am, Josh Nathanson [EMAIL PROTECTED] wrote: Is there a cool way to check if an object is a jQuery object as opposed to any other object? I tried the constructor property but it just says Object(), the same as any other object. Tried typeof, but same deal, just object. Right now my function can take an object or a jQuery object as an argument, and all I've figured out is that the jQuery object is indexable (array-like), so if the object is not jQuery it will return undefined if I say obj[0]. But, this seems like a hack - is there a better way to test the object's type? -- Josh How about: if (obj.jquery) { // it is a jquery object - jquery holds the version } else { // not a jquery object }
[jQuery] Re: Test if object is jQuery object
if (obj.jquery) { // it is a jquery object - jquery holds the version } else { // not a jquery object } Thanks Eric and Wizzud, that's what I was looking for. Much better than what I was doing. -- Josh
[jQuery] Re: Test if object is jQuery object
Another option would be obj instanceof $ On 10/30/07, Josh Nathanson [EMAIL PROTECTED] wrote: if (obj.jquery) { // it is a jquery object - jquery holds the version } else { // not a jquery object } Thanks Eric and Wizzud, that's what I was looking for. Much better than what I was doing. -- Josh -- Yehuda Katz Web Developer | Procore Technologies (ph) 718.877.1325
[jQuery] Re: test
success! On 9/17/07, KushM [EMAIL PROTECTED] wrote: test -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: test
Yes they are :-) On 9/5/07, Daniel Rossi [EMAIL PROTECTED] wrote: my emails arent coming through
[jQuery] Re: test
On Sep 5, 11:40 am, Daniel Rossi [EMAIL PROTECTED] wrote: Interesting, im not getting the initial email, just the replies ! I'm using gmail pop though. Same for me, I've renounced to make it work with thunderbird, I use web interface of gmail to send email to the list.
[jQuery] Re: test
Daniel Rossi escribió: Interesting, im not getting the initial email, just the replies ! I'm using gmail pop though. On 05/09/2007, at 7:24 PM, Dylan Verheul wrote: Yes they are :-) On 9/5/07, Daniel Rossi [EMAIL PROTECTED] wrote: With GMail, your messages has not shown in the conversations. You can use Thunderbird or another email client ;-) -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] Re: test
On 05/09/2007, at 9:06 PM, SeViR wrote: Yes they are :-) On 9/5/07, Daniel Rossi [EMAIL PROTECTED] wrote: With GMail, your messages has not shown in the conversations. You can use Thunderbird or another email client ;-) Gmail pop here, I use Mac Mail. Thunderbird is terribly broken on mac, it's a terrible product, I reverted to Mac mail last week :) Anyway I'm curious if my email came through about the plugin detection API.
[jQuery] Re: test
I think Gmail changed something, I don't see my replies to group mails until someone else answers again. The emails are in the sent folder until then. Fred On 9/5/07, Daniel Rossi [EMAIL PROTECTED] wrote: Interesting, im not getting the initial email, just the replies ! I'm using gmail pop though. On 05/09/2007, at 7:24 PM, Dylan Verheul wrote: Yes they are :-) On 9/5/07, Daniel Rossi [EMAIL PROTECTED] wrote: my emails arent coming through
[jQuery] Re: test
You are excused :) On 7/12/07, Salvatore FUSTO [EMAIL PROTECTED] wrote: excuse for this test -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: test
thanks :) - Original Message - From: Aaron Heimlich To: jquery-en@googlegroups.com Sent: Thursday, July 12, 2007 5:46 PM Subject: [jQuery] Re: test You are excused :) On 7/12/07, Salvatore FUSTO [EMAIL PROTECTED] wrote: excuse for this test -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Test
passed :) On 6/22/07, Rey Bango [EMAIL PROTECTED] wrote: Test -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com
[jQuery] Re: Test
you really should return false; On 6/22/07, Benjamin Sterling [EMAIL PROTECTED] wrote: passed :) On 6/22/07, Rey Bango [EMAIL PROTECTED] wrote: Test -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Test
Actually... it would return true since I do believe he was looking for a positive response. ;) On 6/22/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: you really should return false; On 6/22/07, Benjamin Sterling [EMAIL PROTECTED] wrote: passed :) On 6/22/07, Rey Bango [EMAIL PROTECTED] wrote: Test -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com
[jQuery] Re: Test
LOL! Benjamin Sterling wrote: Actually... it would return true since I do believe he was looking for a positive response. ;) On 6/22/07, *Ⓙⓐⓚⓔ* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: you really should return false; On 6/22/07, *Benjamin Sterling* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: passed :) On 6/22/07, *Rey Bango* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Test -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.iambright.com -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoMedia.com http://www.KenzoHosting.com -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com
[jQuery] Re: test if element as a class
Alexandre Plennevaux wrote: hello, i'm trying to test a condition whether a link has a given class, and have it return true or false. if ($(this).attr(class)=='refresh') { alert(changing page); return true; } else { return false; } Try, from memory: if ($(this).is(.CLASSNAME)) { // IF TRUE } else { // IF FALSE } Regards, Michael Price
[jQuery] Re: test if element as a class
hi Michael, i just did : if ($(this).filter(.selected)) { return true; } else { and it worked ! On Apr 27, 10:44 am, Michael Price [EMAIL PROTECTED] wrote: Alexandre Plennevaux wrote: hello, i'm trying to test a condition whether a link has a given class, and have it return true or false. if ($(this).attr(class)=='refresh') { alert(changing page); return true; } else { return false; } Try, from memory: if ($(this).is(.CLASSNAME)) { // IF TRUE } else { // IF FALSE } Regards, Michael Price
[jQuery] Re: test if element as a class
pixeline wrote: hi Michael, i just did : if ($(this).filter(.selected)) { return true; } else { and it worked ! That's not quite right. .filter() returns a jQuery object, which will always evaluate to true. To use it your way, you'd want to do if($(this).filter(.selected).length) which will return 0 if there are no elements, or a positive integer if there are. Michael was correct in his example of $(this).is(.classname), which will return a boolean value as required. -- Best wishes, Dave Cardwell. http://davecardwell.co.uk/javascript/jquery/
[jQuery] Re: Test for a function being defined
Dan G. Switzer, II schrieb: Shelane, Is there a test to know if a function has been defined or declared? function modify(){ ...my code } if(function('modify')) or something like that? A function is just a variable. if( !!modify ) alert(exists); if( typeof modify == function ) alert(exists and is a function); These are just a few methods of testing. Safest way to test for global variables is this: if ( window.myVariableToTestFor ) { // its there! } I've experienced quite a lot cases where checking for a global variable that didn't exists without specifying window as the property's object threw ugly errors. -- Jörn Zaefferer http://bassistance.de
[jQuery] Re: Test for a function being defined
if (typeof(modify)==function){} .:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.: ||:. Nathan Young Cisco.com-Interface Development A: ncy1717 E: [EMAIL PROTECTED] -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Shelane Enos Sent: Tuesday, April 03, 2007 4:41 PM To: jquery-en@googlegroups.com Subject: [jQuery] Test for a function being defined Is there a test to know if a function has been defined or declared? function modify(){ ...my code } if(function('modify')) or something like that?