[jQuery] Re: different lengths by IE and ff

2010-01-07 Thread KeeganWatkins
at first glance, you may be expecting the :hidden selector to work differently than it actually does: http://docs.jquery.com/Selectors/hidden the original implementation, before 1.3.2, checked for either display:none or visibility:hidden, whereas the new implementation selects elements ...if it

[jQuery] Re: $.getScript results in two requests!

2009-11-25 Thread KeeganWatkins
just out of curiosity, have you checked to make sure you aren't using the $.ajax() method (or one of its convenience methods) elsewhere? i see in the first set of headers that the X-Requested-With header is present, which is generally added by jQuery (and most other libs) when a request is

[jQuery] Re: list bullet style

2009-11-24 Thread KeeganWatkins
i'm not sure i understand... hard-coded numbering? something like this (?) : HTML ul li1 spanList Item/span/li li2 spanList Item/span/li li3 spanList Item/span/li /ul if you are looking for a numbered list, you should be using the ol/ tag, although the ol/ tag is going to have the same

[jQuery] Re: GET id value from url in jQuery

2009-11-24 Thread KeeganWatkins
inside of the function that you pass to click(), the keyword this will point to the raw DOM element that dispatched the event. so, in your example, you need to add: $(document).ready( function () { $(.delete).click(function() {

[jQuery] Re: list bullet style

2009-11-23 Thread KeeganWatkins
what do you mean by snappy? you could always just use CSS (not sure how this questions relates to jQuery or JavaScript at all) to replace the bullet with your own image: HTML: ul liList Item 1/li liList Item 2/li liList Item 3/li /ul CSS: ul li {list-style-type:none;background:transparent

[jQuery] Re: No reaction with $('a').click(), OK with dispatchEvent(...)

2009-11-20 Thread KeeganWatkins
At the moment I'm not so interested in the right/smart way to write an a tag. It's more interesting to me to see what the jQuery click() function can and cannot do ok, then read the source. we're trying to offer solutions to the problem, but if you just want some info on what jQuery's click

[jQuery] Re: jq 1.3.2 in IE6 syntax error line 324

2009-11-20 Thread KeeganWatkins
can you post a test page? just by scanning, there isn't anything that jumps out at me as being broken/syntactically incorrect... just a tip, though, you can combine your selectors to make that part more efficient: $(function(){ $('#username, #password, #valicode').keydown(function(event){

[jQuery] Re: show/hide div on select change

2009-11-20 Thread KeeganWatkins
also, just as a head's up... even when you store numbers as the value attribute on an option/ tag, they are interpreted as strings in javascript. so, from your example above, you might also consider switching your condition to: // Compare as string instead if ($(#id_status).val() === '6'){

[jQuery] Re: imitate link

2009-11-20 Thread KeeganWatkins
charlie and dave are correct: you should use elements semantically to ensure your content runs on as many platforms/devices/configurations as possible. with that being said, there is a simple answer to your original question: HTML: strong id=fake_linkHome/strong JS:

[jQuery] Re: IDEs of jQuery

2009-11-19 Thread KeeganWatkins
Aptana (built on Eclipse) also has great jQuery support. http://aptana.com/ On Nov 19, 9:28 am, devilmike devilm...@gmail.com wrote: This isn't specifically for jQuery, but NetBeans handles it extremely well. I use the Early Access for PHP version. Michael On Nov 19, 4:13 am, Ankur_Patel

[jQuery] Re: No reaction with $('a').click(), OK with dispatchEvent(...)

2009-11-19 Thread KeeganWatkins
if you have to keep your JavaScript inline, you should use the onclick attribute instead of using the javascript: pseudo-protocol. it was never fully standardized, and is a lingering piece of old-school JavaScript usage. so for your example above, use: a id=a1 onclick=doSomething();#a1/a an even

[jQuery] Re: What is the opposite of :checked?

2009-11-19 Thread KeeganWatkins
should also be pretty easy to roll your own :not-checked selector: $.expr[:][not-checked] = function(elem, i , m) { // use === false to avoid undefined checked property // creating false positives return elem.checked === false; } On Nov 19, 3:00 pm, Charlie Griefer

[jQuery] Re: Can I somehow see what events are binded to a DOM element?

2009-10-29 Thread KeeganWatkins
jayarjo, you might be interested in firequery, an experimental firebug extension that visualizes jQuery manipulations. http://firequery.binaryage.com/ On Oct 29, 7:54 am, Bjarki bjar...@gmail.com wrote: Using firebug: you can write $('selector').data('events') in the console and run it. then

[jQuery] Re: Browser refresh

2009-10-21 Thread KeeganWatkins
hi lukas, you can't specifically listen for refreshes, but you can listen for unload events. an unload event is dispatched when: - a link is clicked to navigate away from the page - the window.location property is changed - the tab is closed - the browser window is closed - etc to play around

[jQuery] Re: Unexpected $(document).ready() behavior when jQuery is loaded after the page

2009-10-08 Thread KeeganWatkins
Hi Ryan, The reason you are having problems is likely due to the way jQuery determines DOM readiness. As noted above, if functions are passed to $ () or $(document).ready() after the DOM has loaded, they are executed immediately. This produces the behavior you are expecting. But when jQuery

[jQuery] Re: Select by containing text

2009-10-06 Thread KeeganWatkins
Hi Julijan, It sounds like what you need is a :text-equals filter The reason :contains fails in this case is because it does a global match. By anchoring the same RegExp against the beginning and end of the string, you should be able to select elements whose text matches exactly: // Existing

[jQuery] Re: .ajax() with dataType: 'jsonp' will not use error callback if request fails

2009-10-02 Thread KeeganWatkins
I think this is a known limitation of jsonp as a technique, not a bug with jquery itself. Jsonp works by appending a script tag to the DOM, whose src attribute points to the URL you specify. The URL is expected to wrap a json object in a function call to the function you specify, and the returned

[jQuery] Re: Convert MooTools to jQuery

2009-09-25 Thread KeeganWatkins
hi GonzoDesign - this is a straight port. i'm not that familiar with mootools, so one aspect that may be off is the selection of elements. i'm assuming $ ('europe') returns the element with an ID of europe but if not you'll need to change the ported selectors. you can read up on how jQuery

[jQuery] Re: Each function gives errors in IE6

2009-09-25 Thread KeeganWatkins
hey Shane, Nick's comments above simply reinforce the need for explicit variable declaration. ignoring the var keyword, even when picking names that don't collide with properties of the window object, is a dangerous practice. it leads to hard-to-spot bugs, scope issues, and a whole mess of other

[jQuery] Re: validate - if other checked -- require input box

2009-09-25 Thread KeeganWatkins
are you using the validate plugin? i'm not familiar with it at all, but for a simple validation like this you could do: // DOM-ready handler $(function() { // Listen for onsubmit events for the form $(#signupForm).submit(function() { // Get the checkbox

[jQuery] Re: if opera...... else

2009-09-25 Thread KeeganWatkins
hi a1anm, if it's a CSS property, you can always determine that without relying on the deprecated $.browser object... $(function() { // Check for the property you are interested in. Will be a Boolean value var opera = typeof $(body)[0].style[OperaOnlyCSSProp] === undefined;

[jQuery] Re: this.reset() doesn't work

2009-09-16 Thread KeeganWatkins
@Dhruva- It should be $(this).reset(); That won't work. Note that reset() is a method that is available on raw form elements in the DOM, but not on a jQuery-wrapped set. // Example for Firebug console.log(jQuery.fn.reset) // undefined @pritisolanki - You can't expect the selector engine (or

[jQuery] Re: Simple/short way to bind one event to multiple objects?

2009-09-15 Thread KeeganWatkins
The change event handler can also be passed by reference, avoiding the need for the closures (#obj1,#obj2,#obj3).change( setupPage ); On Sep 15, 7:40 am, Mr Speaker mrspea...@gmail.com wrote: you can select multiple objects in the selector, like: $ (#obj1,#obj2,#obj3).change(...) On

[jQuery] Re: get values from a select menu then assign them to an array variable

2009-09-09 Thread KeeganWatkins
Hi runrunforest, To elaborate on Benn's explanation, the $.each and $().each() methods provide two arguments inside the callback you supply. The first is the index (either an enumerated key for arrays or a string key for objects). The second is the value (the value associated with the current

[jQuery] Re: data parameter in live

2009-09-09 Thread KeeganWatkins
Hi saqib, The live() method doesn't allow for passing custom data to the handler. http://docs.jquery.com/Events/live#typefn There are possible solutions, though. Depending on what you need to pass, you might be able to do so by using the data() method to store your values on an element, and

[jQuery] Re: Testing the first character of an H1

2009-09-03 Thread KeeganWatkins
You can always create a new selector, one that works *almost* as :contains does. The issue in your case (as I understand it) is that :contains does a global search, so text that is not at the beginning is still matched. It sounds like what you need is a :begins- with filter. Extending the filter

[jQuery] Re: How to detect window is scroll or not using window.scrollTo()

2009-09-01 Thread KeeganWatkins
@Rupak, I'm not sure if this answers your question, but all wrapped sets have a scrollTop() method that can be used to retrieve or set the scrollTop value. For example, to determine how far down the page has been scrolled, you can use: var top = jQuery(window).scrollTop(); The same method can

[jQuery] Re: How to detect window is scroll or not using window.scrollTo()

2009-09-01 Thread KeeganWatkins
Here's the docs: http://docs.jquery.com/CSS/scrollTop On Sep 1, 9:34 am, KeeganWatkins mkeeganwatk...@gmail.com wrote: @Rupak, I'm not sure if this answers your question, but all wrapped sets have a scrollTop() method that can be used to retrieve or set the scrollTop value. For example

[jQuery] Re: Settimeout on Function

2009-08-31 Thread KeeganWatkins
. On Aug 30, 7:22 pm, a1anm alanmoor...@gmail.com wrote: Hi, I tried this but it didn't work.  It resulted in the class not being removed at all.  You can see here: http://www.toomanydesigns.com/test/noflash/ On Aug 30, 11:20 am, KeeganWatkins mkeeganwatk...@gmail.com wrote: The basic

[jQuery] Re: Settimeout on Function

2009-08-30 Thread KeeganWatkins
The basic syntax for delaying a function using setTimeout is this: setTimeout(function() { // ...code here executes when the timeout is complete }, 2000 /* Length of timeout, in milliseconds */); so for your example, something like this should work: $(document).ready(function(){

[jQuery] Re: Reading text value on button element

2009-08-28 Thread KeeganWatkins
Jesper, in your first example, you were passing the string this, not the keyword. The keyword this is a reference to the button (in that case), and the string this is useless for that purpose. In your second example, you are creating a wrapped set, accessing the first element in that set, and

[jQuery] Re: innerWidth doesn't measure scrollbars in Safari/Chrome

2009-08-27 Thread KeeganWatkins
@tinker - first, as BabBna suggested, don't hijack someone else's post! :) second, in relation to your question, here is what you need: var scripts = document.getElementsByTagName(script); var thisScript = scripts[scripts.length - 1]; after running this code, the variable thisScript is now a

[jQuery] Re: $.inArray optimisation

2009-08-25 Thread KeeganWatkins
it does not work in every browser. the purpose of jQuery and similar libraries is to streamline development and create a (mostly) consistent foundation to build on, regardless of browser. if you're interested in gaining some performance, or just using the latest JS features, i'd suggest

[jQuery] Re: $.inArray optimisation

2009-08-25 Thread KeeganWatkins
...@gmail.com wrote: IMO, it doesn't belong in the core I think I read somewhere that a check for that usage will be in 1.3.3 core, but damned if I can find where I saw that stated On Aug 25, 9:59 am, KeeganWatkins mkeeganwatk...@gmail.com wrote: it does not work in every browser. the purpose

[jQuery] Re: Safest way to test is a variable is a jQuery object?

2009-08-24 Thread KeeganWatkins
have you considered just checking for a jQuery method? seems like that would be the cleanest, least intrusive way of doing your check, for example: function get_object_from_id(variable) { // if the param has a attr property (which jQuery objects do, //

[jQuery] Re: how to get back the DOM element as HTML source

2009-08-21 Thread KeeganWatkins
i wrote a really simple plugin for this, as i frequently have the same use case: jQuery.fn.outerHTML = function() { return jQuery(div/).append( jQuery(this[0]).clone() ).html(); } so that i could call it on any element, such as: $(#fooID).outerHTML(); On Aug 19, 9:55 am, John

[jQuery] Re: Checkbox perpetually marked as checked

2009-08-21 Thread KeeganWatkins
Jon is correct... you are using an assignment operator in place of an equality operator. the code you have above executes to mean: // this isn't a test for the checkbox's state, it just sets it to true if (document.getElementById(ownCheck).checked = true) ownerCheck = true; else

[jQuery] Re: FF processes this line fine; IE doesn't...why?

2009-08-16 Thread KeeganWatkins
Can you be sure that the response isn't being cached in IE? Even if the .cfm response is changing, you might try to bust the cache with a semi-random query string, i.e: var path = '../components/propertiesDisplay.cfm?' + (new Date).getMilliseconds(); $(#hiddenResult).load(path, null,

[jQuery] Re: Access denied when calling webservice method using jquery

2009-08-14 Thread KeeganWatkins
can you post some code? it's hard to offer suggestions with nothing more than an error code to analyze... although I'd bet you're calling your webservice via Ajax, and that the service is not on the same domain. if this is the case, you'll need to either: a) move the service to the same domain

[jQuery] Re: Regular Expression validation

2009-08-09 Thread KeeganWatkins
With all due respect, I think karl's solution is somewhat less than elegant, and could be improved by refactoring to: // test for anything but numbers var isValid = /[^\d]/g.test(textareaValString); if (isValid) { // proceed with confidence } else { // note to user: no numbers allowed!

[jQuery] Re: Checkbox behaviour

2009-08-08 Thread KeeganWatkins
In general, form selections will persist when the page is refreshed. If you add a random query string like ?foo=bar, you should see your selections reset. In regards to james' comments above, I think it would be far cleaner to reset the form before the page unloads. This is a simple task:

[jQuery] Re: Is there a more efficent way to write this script?

2009-07-10 Thread KeeganWatkins
you should be able to include all those elements in a single set, and then apply the styles once. for example: $(this).find(a).css(text-decoration , underline); Note that this will grab ALL the descendant links inside the .JQorangeHighlight element. On Jul 10, 8:33 am, Jacques Choquette -

[jQuery] Re: noob problem with selector and wrapped set - SOLVED

2009-07-10 Thread KeeganWatkins
: Thanks for the info, Ralph and Keegan. I performed the ugly: jQuery('#' + id.replace(/:/g, '\\:')) But the other suggestions look good too (plus there is nothing to escape - bonus.) Cheers, On Thu, 2009-07-09 at 16:15 -0700, KeeganWatkins wrote: Or you can use the attribute selector

[jQuery] Re: save ajax query to global variable

2009-07-10 Thread KeeganWatkins
BaBna is correct, the alert is firing before the response has come back, try adding the alert inside the callback. however, i would not recommend removing the var keyword. as it is now, you have: script type=text/javascript var tb1=[]; $(document).ready(function() { //

[jQuery] Re: img src attribute after append(), html()...

2009-07-10 Thread KeeganWatkins
oops, not href attribute, as its an image. still holds true though. On Jul 10, 1:00 pm, KeeganWatkins mkeeganwatk...@gmail.com wrote: jQuery isn't actually changing your href attribute, the browser is... when you use relative paths in links (and some other elements as well) the browser

[jQuery] Re: img src attribute after append(), html()...

2009-07-10 Thread KeeganWatkins
jQuery isn't actually changing your href attribute, the browser is... when you use relative paths in links (and some other elements as well) the browser automatically appends the domain. if you need something else, either change your relative paths to mirror something that works for you, or

[jQuery] Re: Can I catch the property of CSS filter?

2009-07-10 Thread KeeganWatkins
you'll need to use a regular expression to get what it is that you are looking for... something like this might work: pre // get the full string var filterString = $('img').css('filter'); // get the src='aa.png') piece var filterSource = filterString.replace

[jQuery] Re: noob problem with selector and wrapped set

2009-07-09 Thread KeeganWatkins
Ralph is correct, as jQuery uses the colon as a prefix for selector filters like :hidden and :last. To fix, you can just pass in the raw node like this: jQuery(document.getElementById( actual element ID)) which will return the wrapped set. Cheers. On Jul 8, 3:47 pm, Ralph Whitbeck

[jQuery] Re: noob problem with selector and wrapped set

2009-07-09 Thread KeeganWatkins
Or you can use the attribute selector for brevity: jQuery([id=' + actual element id + ']) which will return the same element. Hope that helps. On Jul 9, 6:10 pm, KeeganWatkins mkeeganwatk...@gmail.com wrote: Ralph is correct, as jQuery uses the colon as a prefix for selector filters like

[jQuery] Re: reload an SWF object from jquery

2009-07-02 Thread KeeganWatkins
The issue is that your selector returns a jQuery object, not a raw DOMElement, which is what swfobject and/or ExternalInterface expect. Use this instead: var elem = $(#someId)[0]; elem.reload(); the difference is that by using array access to get the first element in the wrapped set, you can

[jQuery] Re: JQuery Implementation

2009-05-10 Thread KeeganWatkins
not sure how/why this question keeps coming up, but the answer is no. there was a post on this group claiming that jQueryUI was calling home to jqueryui.com, when in fact that author was simply linking to the script on the jqueryui.com domain, but i digress... the jQuery library does not