[jQuery] Re: findValue

2009-03-19 Thread ricardobeat
I guess the problem is this line: var ac = $("#operator")[0].autocompleter.findValue(); $(..)[0] gives you the first HTML Element in the object. It's not a jQuery object anymore, so the autocompleter property doesn't exist. IDs should be unique so that is unneeded, try changing it to var ac =

[jQuery] Re: Best way to select dom element ? (find or children ?)

2009-03-19 Thread ricardobeat
This is a bit more efficient: $('.test1').change(function(){ var test1 = $(this).val(); var test2 = $(this).closest('li').next('li').find('select.test2').val (); alert("Test1: "+test1+"and Test2: "+test2); }); Or to avoid repeating the traversal every time: $('#idfortheUL li').each(functi

[jQuery] Re: Trying to animate the .before()/.after() dom action

2009-03-19 Thread ricardobeat
All I see is a brief flash at the end of the animation, not very noticeable, both in IE and FF. I suppose there isn't a way to avoid that as you are removing/appending the elements. Maybe fixing the $targetNode position with position:absolute before the after/before call, that should avoid some of

[jQuery] Re: Unbind by Function Reference

2009-03-19 Thread ricardobeat
> On Mar 19, 3:40 pm, ricardobeat wrote: > > > Since jQuery 1.3 you can use the live() function, so you don't need to > > rebind the events. > > > Just set $('table caption a').live('click', addItemFinal) once in $ > > (document).ready() an

[jQuery] Re: Javascript city state zipcode country component

2009-03-19 Thread ricardobeat
I'm using Maxmind's GeoLite City open-source database. It's free and has surprising accuracy. They also have paid webservice plans with more precise data. http://www.maxmind.com/app/geolitecity cheers, - ricardo On Mar 19, 12:06 am, Vijay Balakrishnan wrote: > Hi, > > Has anyone used a stable

[jQuery] Re: Unbind by Function Reference

2009-03-19 Thread ricardobeat
Since jQuery 1.3 you can use the live() function, so you don't need to rebind the events. Just set $('table caption a').live('click', addItemFinal) once in $ (document).ready() and all anchors added to the doc afterwards that match this selector will fire the function on click. live() uses what

[jQuery] Re: Look for

2009-03-18 Thread ricardobeat
It's not faster, it actually adds a bit of overhead. From jQuery source code: // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return (context || rootjQuery).find( selector ); that means everytime you type $('.someclass', this) it's effectively being "transla

[jQuery] Re: Using 1.3 this: [class!=whatever] doesn't work.

2009-03-18 Thread ricardobeat
Your example is working fine for me with 1.3.2 - $('a[class! =whatever]'). $('a[className!=whatever]') should also work. cheers, - ricardo On Mar 18, 9:26 am, will wrote: > Hi, > Using :not() worked great. > Cheers > Will > > On Mar 18, 11:09 am, "T.J. Crowder" wrote: > > > Hi again, > > > *bl

[jQuery] Re: Find element. How can I do this?

2009-03-18 Thread ricardobeat
The logic is all there in the source code. You can see that all of the fieldset's children get removed and appended to the DIV - that would include the first OL, that's why it doesn't work. This is just another wild guess, I can't test it: var legend = fieldset.find(':first'); var body =

[jQuery] Re: :visible change

2009-03-18 Thread ricardobeat
You're missing a closing parenthesis in your IF statement. Other than that, your code works fine: http://jsbin.com/oguqe/edit Something else must be wrong in your page, do you have a live sample we can look at? It all could also be rewritten as $('.closeEl').click(function(){ $(this).parent

[jQuery] Re: show hide random rows

2009-03-18 Thread ricardobeat
If you need performance, this should be it: http://jsbin.com/uvuzi/edit It sorts the rows using the "Fisher-Yates" shuffling algorithm. Despite throwing elements around in an array, it's faster than the pure mathematical solution because you don't need to filter out duplicate random numbers. An

[jQuery] Re: $('.edlBoxArea').corners is not a function

2009-03-17 Thread ricardobeat
Are you using jquery.noConflict() in your app? What do you get on console.log( jQuery.fn.corners )? On Mar 17, 1:17 pm, boy_named_Goo wrote: > I'm trying to use the rounded corners plugin -- jquery.corners.js . > > When I create a small test case, below, it works fine.  However, when > I try to

[jQuery] Re: Find element. How can I do this?

2009-03-17 Thread ricardobeat
Try this: var body = fieldset.find('ol:first') http://docs.jquery.com/Selectors On Mar 17, 12:13 pm, shapper wrote: > Hello, > > I am trying to find update a plugin to create new functionality. > On the current version I have the following: > >     var legend = fieldset.find(':first'); >    

[jQuery] Re: loop through div

2009-03-17 Thread ricardobeat
n error > > thanks! > On Mar 16, 7:26 pm, ricardobeat wrote: > > > jQuery.fn.showLoop = function(i){ > >   var i = i || 0, > >     self = this; > >   $( this[i] ).show(600, function(){ > >        self.showLoop(++i); > >   }); > > > }; > &g

[jQuery] Re: loop through div

2009-03-16 Thread ricardobeat
jQuery.fn.showLoop = function(i){ var i = i || 0, self = this; $( this[i] ).show(600, function(){ self.showLoop(++i); }); }; $('.type').showLoop(); On Mar 16, 7:27 pm, Tom Shafer wrote: > how can i loop through each div on a page and have them appear one by > one > i am tryin

[jQuery] Re: Dependant on string does not work

2009-03-16 Thread ricardobeat
Have you tried 1.3.2? A lot of selector bugs have been fixed in this release. Try changing it to return !!$(element.form).find(param).length and see if it works. - ricardo On Mar 16, 4:30 pm, chielsen wrote: > So i upgraded to the latest version and waisted my day :( > Seems like the dependant

[jQuery] Re: unbind all events from jquery 1.3.2

2009-03-16 Thread ricardobeat
You could simply use $(window).trigger('unload') That will unbind all events bound through jQuery. A function for doing that is already defined in the source code: jQuery( window ).bind( 'unload', function(){ for ( var id in jQuery.cache ) // Skip the window

[jQuery] Re: Change Table Row Color based on column content

2009-03-16 Thread ricardobeat
Assuming you have this: Something here You'd use this javascript: $('#dj .options tr').each(function(){ var self = $(this); self.find(':checkbox').click(function(){ self.toggleClass('selected') }); }); I don't know if it's possible for the click event to fire

[jQuery] Re: test for .is(":visible") fails in Safari

2009-03-14 Thread ricardobeat
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(); }

[jQuery] Re: Flying clouds like in http://devthought.com/

2009-03-14 Thread ricardobeat
uot; }, 2000, function(){ animateMe(); }); })(); On Mar 14, 3:26 pm, Grom wrote: > Its not that. He wrote code to move image using mootools. Im looking > for something to move image on page for Jquery > > On 14 Mar, 18:44, ricardobeat wrote: > > >http://devthought.com/p

[jQuery] Re: wrap some tag around group of table rows for hide and show

2009-03-14 Thread ricardobeat
You can't wrap any element around s. Tables can only contain a tbody/thead/tfoot and TRs, if you insert an element that is not allowed, it itself will be wrapped by a new TR created by the browser, and you'll get all kinds of misbehavior. You could insert a new tbody, but browser handling of them

[jQuery] Re: Flying clouds like in http://devthought.com/

2009-03-14 Thread ricardobeat
http://devthought.com/projects/mootools/apng/ On Mar 14, 12:29 pm, Grom wrote: > Hello. > I want to add flying clouds like onhttp://devthought.com/on my site. > Do anyone know how to do that? Maybe any suggestions?

[jQuery] Re: Why won't this work in ie ?

2009-03-13 Thread ricardobeat
try this, with the proper closing slash as you're using for : $.each(json, function(i, item){ $('') .attr('href', 'http://example.com') .html('test') .appendTo('#gallery'); }); } On Mar 12, 4:57 pm, joshm wrote: > In my jquery code I do: > $.each(json, function(i, item) { > $('

[jQuery] Re: whats wrong with my custom selector :readonly (IE6 sucks)

2009-03-13 Thread ricardobeat
ought that you always have to > select attributes with [..] or .attr(..) Is this an officially working > function? > > Thanks :-) > Gerald > > > > ricardobeat wrote: > > > You're returning the object you created, so that will always be true. > > Return

[jQuery] Re: JQuery Selector

2009-03-13 Thread ricardobeat
It's not a selector. Where did you come across that? The "< >" makes it think you want to create an element. It does nothing more than creating a textNode that contains the string "<%=x.y %>" (and a temporary DIV to hold it). This $('< >') does the same. The '#' is ignored just as if you used $

[jQuery] Re: whats wrong with my custom selector :readonly (IE6 sucks)

2009-03-12 Thread ricardobeat
You're returning the object you created, so that will always be true. Return the .length property and it shoud work: $.extend($.expr[':'],{ readonly: function(a) { return !!$(a).filter('[readonly="true"], [readonly=""]').length; } }); But a simpler/faster/safer alternative is the

[jQuery] Re: Dynamically generate file with jquery

2009-03-11 Thread ricardobeat
When javascript/HTML kicks in the headers have already been sent, there is nothing you can do except offering copy & paste :) A server-side script that does it for you is not much of a burden, it could be made very light. I think you could get the text from POST and stream it directly without th

[jQuery] Re: How to prevent third-party CSS code override our CSS

2009-03-11 Thread ricardobeat
Just wrap your re-usable parts in a container with an ID. IDs have greater weight on CSS rules, that will usually be enough. putting ! important on all your rules will bloat your code unnecessarily. See this article on CSS specifity: http://www.smashingmagazine.com/2007/07/27/css-specificity-thin

[jQuery] Re: live() not working in IE8?

2009-03-11 Thread ricardobeat
How about $('#orderlineform #productlisting').load('orderProxy.cfm', { mode:'getAvailableProducts', ordergrade_id:ordergrade_id, order_id:order_id }, function(){ $(this).find('#product_id').change (isRentalActive); }); On Mar 11, 11:19 am, Todd Rafferty wrote: >

[jQuery] Re: Switching Content in same div

2009-03-11 Thread ricardobeat
Can't you load both products, each in it's own container, and show/ hide them? That's easier and faster. $('#products .blue').show(); $('#products .red').hide(); etc. On Mar 11, 11:30 am, Desinger wrote: > Hi, > > Product page would like to load different contents in same di

[jQuery] Re: Undefined function

2009-03-10 Thread ricardobeat
Just a guess: are you defined that function inside $(document).ready () ? If you are, it's only available inside that scope, you should define it outside so it's declared globally. But a better approach is, like mike said, to use proper event binding instead of inline attributes. It's cleaner and

[jQuery] Re: Does the "ready" event wait for JavaScript files to be downloaded?

2009-03-10 Thread ricardobeat
If the scripts are not present at page load they will load after ready has already fired. You'll have to use a callback (like in JSONP) to fire when a script has loaded. There was a posting recently about a plugin that loads js in an iframe and uses the body onload event, but I can't remember it's

[jQuery] Re: How to prevent refreshing jQuery menu and still have SEO friendly links/pages??

2009-03-10 Thread ricardobeat
You can keep a sitemap with the whole structure, but ideally you shouldn't use AJAX to load whole pages in place of links. "Reloading" different pages is not bad. On Mar 10, 10:20 am, 123gotoandplay wrote: > Hi all, > > How do i prevent my jQuery from reloading per page, but still have SEO > fr

[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.

2009-03-09 Thread ricardobeat
Looks great. I like how the editing works. One thing: why are you using DIVs instead of a table? That's precisely the only case where tables should be used, to display tabular data. It's semantically correct and can offer performance improvements, as table elements have native properties like the

[jQuery] Re: Help with selectors and :not()

2009-03-09 Thread ricardobeat
:not(tr[id^="review"]) that says: trs which do NOT contain an id that does NOT equal "review". in other words, TRs which DO contain the word "review" in it's id. You want "not contains" instead: $('#replies tr[id^=r]:not ([id*=review])'); cheers, - ricardo On Mar 9, 1:55 am, Yansky wrote: > H

[jQuery] Re: Regular Expression that works everywhere but in jQuery

2009-03-07 Thread ricardobeat
this seems to work: scrubbed = code.html().replace(/]*-->/gi,""); The expression you had would eat everything between the first "". There's probably a more elegant way to do it, but I can't help any further. cheers, - ricardo On Mar 6, 4:10 pm, Adam wrote: > Hey there, > > I'm trying to use J

[jQuery] Re: filter some elements problem

2009-03-07 Thread ricardobeat
You can satisfy condition 1 and 3 with this: $('a:not([href*=javascript])[target!=_blank]') But it's not that easy for nº 2. What is saved on the onclick attribute is a function, not plain text. You can see the source code of the function with the .toString() method, so you could do this: $('a:

[jQuery] Re: Adding values from a variable number of select drop downs

2009-03-07 Thread ricardobeat
function weightTotal(){ var total = 0; $('.weight').each(function(){ total += +$(this).val(); //if it's an empty string +"" == 0 }); $('#grand_total').html( total + "%" ); } cheers, - ricardo On Mar 6, 9:58 pm, shallowman wrote: > Hello all, > > I am trying to add the values

[jQuery] Re: New JQuery User, How do I call this function with timed Interval

2009-03-06 Thread ricardobeat
Try setInterval(function(){ $('#sliderotate').click(); }, 5000); or setInterval(EYE.spacegallery.next, 5000) // without the $ and the "s On Mar 6, 11:39 am, Timz66 wrote: > I am trying modify Photo gallery and I want it to rotate through the > images, I currently use > setInterval("document.get

[jQuery] Re: transition between two classes

2009-03-05 Thread ricardobeat
It's a Wiki, something has broke. I edited it back to the last working revision temporarily: http://docs.jquery.com/UI/Effects/ClassTransitions You should report this at the jquery-UI group for them to fix it properly. cheers, - ricardo On Mar 5, 6:26 pm, Brian Yanosik wrote: > Does anyone hav

[jQuery] Re: Use iFrame like a normal document

2009-03-05 Thread ricardobeat
You need to use the iframe's document as the context $('#my_iframe').contents().find('div_im_trying_to_find').offset(); or $('div_im_trying_to_find', $('#my_iframe')[0].contentDocument).offset (); I'm curious to know if the dimensions methods will work on it. - ricardo On Mar 5, 1:50 pm, cjhil

[jQuery] Re: Get contents of first child tr, td with class

2009-03-05 Thread ricardobeat
You're confusing :first with :first-child. :first-child means the element must be the first child of it's parent - the never is, that would be the . Also you have the ".activity_date" class in your selector but ".date" in your HTML. From your code this is what you need to get the content of the f

[jQuery] Re: .clone a form

2009-03-05 Thread ricardobeat
You can append more than one thing at a time: $('#clonehere').append($('.hook:first').clone(true), "Some text"); On Mar 5, 3:35 pm, bstoppel wrote: > You're totally right. In my real code I am appending text as well as > the cloned form.

[jQuery] Re: Simple one: difference between varXy.find(':text') and $(varXy).find(':text')

2009-03-05 Thread ricardobeat
processing and/or time saved > by using var with elements?  Especially if there is only one or two > references on a page? > > Rick > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of ricardobeat &g

[jQuery] Re: Javascript search library

2009-03-05 Thread ricardobeat
Maybe you can use jQuery's filter method: $(JSONObject).filter(function(){ return this.cactus = 'green' && !this.water; }); On Mar 4, 11:00 pm, Khai wrote: > I have a collection of DIVs (or a JSON array).  Is there a javascript > library that can search through a JSON array and return a co

[jQuery] Re: Need to insert an element in DIV at position X Y

2009-03-05 Thread ricardobeat
Insert anywhere and use position:absolute. On Mar 5, 8:03 am, choesang wrote: > Hi! > > I am trying to create a webpage where users can insert a pin (div) in > between the text using context menu. > My problem is that i do not know how to insert at the exact position. > Using Dom's I can arrive

[jQuery] Re: Simple one: difference between varXy.find(':text') and $(varXy).find(':text')

2009-03-05 Thread ricardobeat
It's mostly done to improve performance. If you save the jQuery object in a var you only need to find the element once (depending on the selector it's an expensive operation), and then operate on that single object. I (and other people) like to put a '$' in front of the var name when it contains a

[jQuery] Re: Objects Methods as event handlers.

2009-03-04 Thread ricardobeat
I wouldn't call it 'corruption'. It's just a different approach. In jQuery 'this' will always refer to the element to which the method is being applied. And the data() function doesn't add any properties to the element. Any reason to not simply take advantage of scoping? myClass = function( elem

[jQuery] Re: How do I translate this in jQuery?

2009-03-04 Thread ricardobeat
Oh, never noticed that funcionality, that's nice. The 'myIframe' var is unnecessary though. cheers, - ricardo On Mar 3, 3:38 pm, "Matt W." wrote: > function getContentFromIframe(iFrameName) { > >    var myIFrame = $("#"+iFrameName); > >    var content      = myIFrame.contents().find("body").htm

[jQuery] Re: next() question

2009-03-04 Thread ricardobeat
:after is used to insert generated content after an element, not to select the next element. In your code, the :after(...) is doing nothing, it reads as $('ul.tab-menu a').eq(index + 1) - what's working is the index. You don't need to save the index as it's in the scope of the function: $('#tabs

[jQuery] Re: Determine which radio button (if any) is selected on form load.

2009-03-04 Thread ricardobeat
The CF loop doesn't matter, what the HTML output is like? In XHTML the input element is self-closing (/>) and the checked attribute should be checked="checked". If nothing else is wrong, both ways work fine: http://jsbin.com/avodi/ On Mar 4, 9:49 am, Swatchdog wrote: > Thanks for your attention

[jQuery] Re: Selecting a child of 'this'

2009-03-04 Thread ricardobeat
You can save a reference to the child elements (if they'll not change) to avoid finding them over and over: $("#parent").each(function(){ var $child = $(this).find('.child'); var $children = $('.child'); $(this).hover(function(){ $c.show(); },function(){ $children.hi

[jQuery] Re: converting HTML to XML using jQuery

2009-03-03 Thread ricardobeat
Not showing your js function doesn't help much. All .group are descendants of .map, it's not about context. Maybe you want this (rough): $('.map').each(function(){ var xml = ''; $(this).find('> .group').each(function(){ xml += ''; $(this).find('> .group').each(function(){ xml += '';

[jQuery] Re: toggle a checkbox???

2009-03-03 Thread ricardobeat
The best you can do is rewrite it to a simple ternary conditional and use the .checked property direclty: $("input[name^=REQ_ACCT_LAB_]").click(function() { $("input[name=MY_CHK]").attr('checked', this.checked ? 'checked' : ''); }); cheers, - ricardo On Mar 3, 4:15 pm, Jael wrote: > tha

[jQuery] Re: How do I translate this in jQuery?

2009-03-03 Thread ricardobeat
There's not much you can "convert" to jQuery. It's all javascript anyway: function getContentFromIframe(iFrameName) { var content = $('body', $('#'+iFrameName)[0].contentDocument).html (); $('#myiFrame-content').append(content); } - ricardo On Mar 3, 2:56 pm, "Rick Faircloth" wrote: > I

[jQuery] Re: Reordering rows using JQuery

2009-03-03 Thread ricardobeat
As other's have said, you should do this server-side. Anyway, here's a way to do it: var csv = 'Row2,Row1,Row3', mytable = $('#mytable')[0]; //save the table for later csv = csv.split(','); //csv is now an array var ln = csv.length; while(ln--){ //loop csv array in reverse $('#'+csv[ln])

[jQuery] Re: Apply class to range of child elements

2009-03-03 Thread ricardobeat
, - ricardo On Mar 3, 12:21 am, Nic Hubbard wrote: > Hi Ricardo, > > Could you explain why you did %4 for the n variable? > > On Feb 26, 12:16 pm, ricardobeat wrote: > > > I like it cleaner: > > > $('a').each(function(i){ > >    var n = Math.floor(i/1

[jQuery] Re: checkbox array

2009-03-03 Thread ricardobeat
http://www.w3.org/TR/html401/interact/forms.html#adef-name-FORM This is still in use because it's the easiest/fastest way of getting an array with the selected options server-side. There is no simpler alternative. - ricardo On Mar 3, 12:53 am, mkmanning wrote: > That argument's been raging for

[jQuery] Re: Is jquery suitable for this...

2009-03-02 Thread ricardobeat
That's possible, but you'll have to take care of passing the right context everytime: //main page //inside the iframe $ = jQuery = $('iframe')[0].parent.jQuery; $('#myElement', document); //pass the iframe's document as context to exemplify, if you were to do this "from the outside": //main

[jQuery] Re: jQuery.ajaxSetup({ success: ... }) behavior

2009-03-02 Thread ricardobeat
That's correct, ajaxSetup only sets the defaults for every ajax call. Use ajaxSuccess instead: $().ajaxSuccess(function(){ //... }); http://docs.jquery.com/Ajax/ajaxSuccess#callback cheers, - ricardo On Mar 2, 12:08 pm, creemorian wrote: > You're right, this what I'm doing ... I'm afraid I

[jQuery] Re: Newbie needs Help with jquery logic

2009-03-01 Thread ricardobeat
Not sure what this is an answer too (appear as a new subject), but: $("img:not(this)") You have 'this' as a string in there. That's saying "give me all images which are not a 'this' element". Should be this: $("img").not(this) //passing the actual DOM element to not() I prefer to code it this

[jQuery] Re: Change CSS depending on page you're on

2009-03-01 Thread ricardobeat
Yes we are! You're not only talking about the low percentage of browsers with JS off, but more important mobile browsers which don't have full support for javascript. That's a big market. Besides that, using pure CSS is faster, simpler, less prone to errors and follows the unobtrusive principles.

[jQuery] Re: alternate color row starting from a point

2009-02-28 Thread ricardobeat
Two other ways: $('tr.className + tr').each(function(){ var nxt = $(this), i=0; while (nxt.length){ nxt.css('backgroundColor', i%2 ? 'white' : 'red'); nxt = n.next(':not(.className)'); i++; } }); Or this (I prefer the first, this one is probably slower): $('tr.className

[jQuery] Re: Please, help me convert this flash menu into a jQuery menu?

2009-02-27 Thread ricardobeat
You can do that with pure CSS: http://jsbin.com/eyivu http://jsbin.com/eyivu/edit with jQuery: $('#menu li a').hover(function(){ $(this).stop() .css({ backgroundColor: '#C66' }) .animate({ marginLeft: '+=5px' }, 200); }, function(){ $(this).stop() .css({ backgroundColor:

[jQuery] Re: $.post error on response

2009-02-27 Thread ricardobeat
Where are you expecting to collect the response? Are you using a callback? function check_out_image(image_id) { $.post('ajax/checkout_image', {imageid: image_id}, function(resp){ alert(resp); }); } On Feb 27, 2:41 pm, Dan wrote: > I'm using jquery 1.3.2 and trying to send some dat

[jQuery] Re: Problem in selectors

2009-02-27 Thread ricardobeat
It's hard to tell without seeing the HTML code. Works fine here: http://jquery.nodnod.net/cases/196 - ricardo On Feb 27, 2:02 pm, RandyJohnson wrote: > Davide... > > Did you ever get a response. > > I am having a similar problem with 1.3.2 in that I have multiple area > html statements and onl

[jQuery] Re: Waiting for 'each' to finish

2009-02-27 Thread ricardobeat
That's because the animations don't wait. Add the css() to the last element's animation callback function nexthour(object, start, stop) { var $guide = $("#guide"), $divs = $('div.bla'), ln = divs.length; $guide.css('height', $guide.height()); $divs.each(function(index) { $(thi

[jQuery] Re: fastest way to move dom nodes?

2009-02-26 Thread ricardobeat
This should be a little bit faster: var $divB = ('.divB', '#wrapper'); $('#divA').children('.a-specific-class').appendTo($divB[0]); If it's possible, try moving a single wrapper element containing all the links, that will be certainly faster. - ricardo On Feb 26, 8:40 pm, Jack Killpatrick wro

[jQuery] Re: Help me!: $(this) ???

2009-02-26 Thread ricardobeat
t > > > does not. > > > > Any suggestions? Thanks for your help, I'm fairly new to jquery. > > > > // Code does not work...? hmm > > > >   $(".myButtons").click(function(){ > > >      $(this).find('select').val(1);

[jQuery] Re: $('#tab1 tr:gt(0)>td').filter(':nth-child(2n+1)') select also 1st td in row - aargghh

2009-02-26 Thread ricardobeat
What are you trying to select (html)? You're asking for all *odd* td's that are children of the rows. Indexes in JS start at 0, so the first element is odd. Maybe what you want is this: $('#tab1 tr:gt(0)>td:nth-child(2n)') or $('#tab1 tr:gt(0)>td:even') If you actually want the odd ones except

[jQuery] Re: HELP: a = $('foobar'); a.after('xyz') not adding element

2009-02-26 Thread ricardobeat
after() will insert elements 'after' the selected elements in the DOM. If the element is not in the DOM, that is kind of 'outer space', there is no 'after' it. Append and prepend should work just fine: $('foobar') .append('.test') .prepend('test: ') .appendTo('body'); http://jquery.nodn

[jQuery] Re: ?? About the "window=this" in the source code of the jquery

2009-02-26 Thread ricardobeat
In jQuery's core the *local* variable window is being set. You're trying to rewrite the global variable 'window' that already exists. You can only set a var named 'window' in a scope that is not the global one, like this: function giveMeChocolate(){ var window = this; //this == the global windo

[jQuery] Re: Apply class to range of child elements

2009-02-26 Thread ricardobeat
I like it cleaner: $('a').each(function(i){ var n = Math.floor(i/10) % 4; $(this).addClass( n == 0 ? 'first' : n == 1 ? 'second' : n == 2 ? 'third' : n == 3 ? 'fourth' : ''); }); or var classNames = ['first', 'second', 'third', 'fourth']; $('a').each(function(i){

[jQuery] Re: Issue with .text() and line breaks

2009-02-26 Thread ricardobeat
Just remove them if you need: $('span').text().replace('\n', ''); - ricardo On Feb 26, 10:12 am, AdrenalineJunkie wrote: > Im building a form parser(plugin) that will build a json object to a specific > design.  One problem I am having involves how I render some html and > subsequently read th

[jQuery] Re: Problem with class attribute: Why this work in 1.2.6 and doesn't work on 1.3.1???

2009-02-26 Thread ricardobeat
What browser are you testing on? Are you using any kind of minifier/ packer? On Feb 26, 3:46 pm, AndreMiranda wrote: > But why (".detalhes") doesn't work and ("div .detalhes") works??? > thanks!! > > On 26 fev, 15:44, Eric Garside wrote: > > > Actually, the space is telling jquery that you want

[jQuery] Re: ~ selector is not selecting siblings

2009-02-25 Thread ricardobeat
There must be something else wrong in your page. The HTML and selectors you gave work fine (see http://jquery.nodnod.net/cases/175). Can you put a complete sample page online? - ricardo On Feb 25, 8:52 pm, RadicalBender wrote: > The rows are created on the fly, they aren't actually empty.  Here

[jQuery] Re: $('#foo p') or $('p', $('#foo'))

2009-02-25 Thread ricardobeat
uery.com > > > > > On Feb 24, 2009, at 8:28 AM, Stephan Veigl wrote: > > > > > Hi, > > > > > I've done some profiling on this, and $("p", $("#foo")) is faster than > > > > $("#foo p") in both jQuery 1.2.6

[jQuery] Re: What can we use in place of $.browser?

2009-02-25 Thread ricardobeat
According to John Resig $.browser will remain for the foreseeable future. Being deprecated doesn't mean it will be removed soon (or at all). If you're targeting IE6 quirks I'd think it's not that bad to keep using browser detection, but if you're using it to differentiate modern browsers it's bett

[jQuery] Re: Building functions (newbie question)

2009-02-25 Thread ricardobeat
Define the functions in the appropriate scope (either global or inside the function passed to ready). Functions are executed in the scope they are called, so you write them like they were already inside the click handler. $(document).ready(function() { function yourAjaxFunction(){ ... // 't

[jQuery] Re: tbody:first-child & thead

2009-02-25 Thread ricardobeat
Tables have native properties which are much faster to access: $('#myTable')[0].rows.length //number of rows $('#myTable')[0].tBodies[0].rows.length //number of rows in the first tbody cheers, - ricardo On Feb 25, 5:25 am, Alex Wibowo wrote: > Hi all, > I have a code that counts the number of

[jQuery] Re: How to find a div's which have background-img?

2009-02-25 Thread ricardobeat
This will give you all DIVs which have background-image set: $('div').filter(function(){ return !!this.style.backgroundImage; }) If you need to filter by extension or something use indexOf, it's faster than a regex: $('div').filter(function(){ return this.style.backgroundImage.indexOf('.png

[jQuery] Re: Help me!: $(this) ???

2009-02-24 Thread ricardobeat
Probably changing $("tr #button").click(function(){... to this $("tr #button").click(function(){ $("select", this).html("012345"); return false; }); Will fix it. You need to find the select element in the right context, remember that jQuery's selectors work like CSS. Al

[jQuery] Re: Calling method on multiple jQuery objects

2009-02-24 Thread ricardobeat
$('#id') .add(myJQObj) .add(myotherJQObj) .hide() On Feb 24, 8:51 am, Bisbo wrote: > Hi there, > > I can't seem to find a way to perform the same jQuery method on > multiple jQuery objects. I have tried using commas and passing arrays > to the jQuery function but neither works. > > $( $('#

[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)

2009-02-24 Thread ricardobeat
Java applets have a bit slow loading time, and afaik it can't interact with the rest of the page. Using iecanvas.js you would have to write a single code (compliant with the canvas specs) that would work for both IE and FF - but the support in IE might not be complete. have you seen raphaeljs.co

[jQuery] Re: $('#foo p') or $('p', $('#foo'))

2009-02-24 Thread ricardobeat
On Feb 24, 6:10 pm, Jon Sagotsky wrote: > Just to clarify, $("p", "#foo") would be meaningless That's not true. $('p', '#foo') has the exact same result as $('p', $ ('#foo')), the context is executed just as well.

[jQuery] Re: is there something like $('.myClass').contains('val1 or val2 or val3')?

2009-02-23 Thread ricardobeat
This should work, but it's an "inclusive" or (unlike an if/else where only one possibility is choosen) $('.myclass').filter(':contains(one), :contains(two), :contains (three)') On Feb 23, 8:33 am, ggerri wrote: > Hi guys > > is there a way to use logical operators in jQuery e.g. with > 'contain

[jQuery] Re: $('#foo p') or $('p', $('#foo'))

2009-02-23 Thread ricardobeat
up to jQuery 1.2.6 that's how the selector engine worked (from the top down/left to right). The approach used in Sizzle (bottom up/right to left) has both benefits and downsides - it can be much faster on large DOMs and some situations, but slower on short queries. I'm sure someone can explain tha

[jQuery] Re: improper function

2009-02-20 Thread ricardobeat
Your function looks fine. The URL given does not exist. jQuery(function($){ $("#carousel") .html( $("#holder_images").html() ) .carousel3d({ control: 'continuous', radiusY: 0, speed: 1, radiusX: 250,

[jQuery] Re: Jquery Ajax one request, multiple answers problem

2009-02-20 Thread ricardobeat
set cache: false in your $.ajax call to disable cacheing of responses. You can also add a random query parameter to the URL if that doesn't work. - ricardo On Feb 20, 8:53 am, Jsbeginner wrote: > Hello, > > I've been working on a jquery projet (with the lastest stable version of > jquery) that

[jQuery] Re: Using jQuery to Parse XML in AIR

2009-02-20 Thread ricardobeat
It seems you have a misunderstanding here. $(data).text() will get you the innerText/textContent of all the nodes in your XML, it's not converting the whole response back to text. Are you sending the response as 'text/xml' from the server? add complete: function(xhr){ console.log(xhr); } an

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-20 Thread ricardobeat
    now: function(){ return (new Date()).getTime(); }, >         start: function(){ this.time = this.now(); }, >         since: function(){ return this.now()-this.time; } > > }; > > ...and I start the timer in the last row of the last script being > loaded... > > Yes, I know th

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-19 Thread ricardobeat
dang. accidentally pressed "send" while writing, please ignore my last message. No idea about the performance drop, but you can improve your main function. $(this)[0] is unnecessary, you're creating a new jQuery object and throwing it away. // MAIN function getMenuItems(menu) { var menuItems =

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-19 Thread ricardobeat
No idea about the performance drop, but you can improve your main function: // MAIN function getMenuItems(menu) { var menuItems = []; $(menu).find('.MenuItem').each(function(){ var t = $(this), item = false; if (t.hasClass('processMenuItem')) item = getProcessMenuItem (this);

[jQuery] Re: iterate through form elements, wait for post to finish and continue

2009-02-19 Thread ricardobeat
You could use a recursive function: var intervals = $('.interval'), n = 0; var setDates = function(){ intervals.eq(n).doStuff(); //intervals.eq(n) is the current element in the loop n++; $.post(..., function(){ //... if (intervals[n]) setDates(); //re-run the function with t

[jQuery] Re: Counting Lists inside of Lists

2009-02-19 Thread ricardobeat
$(this+ '> li') 'this' is an HTML Element (each LI) and you're trying to concatenate it with a string. That should be $(this).find('li').length or $('li', this).length Note that the list items are not direct children of "this" (the parent LI), so don't use the '>'. cheers, - ricardo On Feb 19,

[jQuery] Re: How to surround All content after a specified HTML attribute H2?

2009-02-19 Thread ricardobeat
Yeah, the browser will try to fix the mark-up you insert. You can't just treat HTML as text unless you are actually building a string for inserting via html/append. cheers, - ricardo On Feb 19, 10:16 pm, Charlie Griefer wrote: > Ricardo - thanks for clarifying on the insertion. > So... when i t

[jQuery] Re: Opacity for a menu background, but not for the element inside

2008-12-12 Thread ricardobeat
This will be easier sometime around 2012 when RGBA and HSLA colors are widely supported :) On Dec 12, 1:22 pm, Liam Potter wrote: > Jim, read the question again ;) > > Anyway. > There is no simple solution to this problem, I'd advise using a PNG > image as it is the cleanest way to achieve this.

[jQuery] Re: How do I use getjson to make two attribute pairs

2008-12-12 Thread ricardobeat
According to the API the URL is in item.link, so you just need to wrap the image in an anchor: function(data){ $.each(data.items, function(i,item){ $("").attr("src", item.media.m) .appendTo("#images") .wrap('"); if ( i == 4 ) retur

[jQuery] Re: nextAll Chaining when nextAll is Empty

2008-12-12 Thread ricardobeat
Do you have a test page we can look at? nextAll returns an empty object if there is no 'next', but it doesn't interrupt the chain, there may be something else going on. I couldn't reproduce your situation here, nextAll().andSelf() returns me the original element. - ricardo On Dec 12, 10:39 am,

[jQuery] Re: getJSON not triggering success callback

2008-12-12 Thread ricardobeat
Check the status in the XHR object you get back, it's probably not successfull. On Dec 12, 11:06 am, "Javier Martinez" wrote: > I'm making some calls with getJSON on another domain, and the callback is > not firing. > My code is the next: > > var url = > 'http://localhost:8080/cometd/cometd?mes

  1   2   3   4   5   6   >