RE: [jQuery] Callback in $.getJSON is called but variable assignment doesn't persist.

2010-01-04 Thread Josh Nathanson
Probably an async issue - any code after the $.getJSON call (but not in the
callback) will get executed before the async call returns.  Any code that is
dependent on this.Settings being set with the returned data must be within
the callback function.

Also this is probably not what you are expecting it to be.  Do an alert or
console.log with this in your callback function to make sure it's what
you're expecting.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Ido Yehieli
Sent: Monday, January 04, 2010 9:55 AM
To: jQuery (English)
Subject: [jQuery] Callback in $.getJSON is called but variable assignment
doesn't persist.

Hi,
on the following code:

$.getJSON(http://www.tametick.com/test2/json/settings.json,function
(data) {
this.Settings = data;
alert(data);
alert(this.Settings);
});

which can be found on http://www.tametick.com/test2 (line 63 in
http://www.tametick.com/test2/js/cardinal-quest.js), I am getting the
alerts correctly (returning the object read from the file) but after
the function ends this.Settings revurts back to null and I get the
error:

Error: Settings is undefined
Source File: http://www.tametick.com/test2/js/cardinal-quest.js
Line: 70

Any idea what is going wrong?

Thanks,
Ido.



RE: [jQuery] Selectors and Internet Explorer

2009-12-10 Thread Josh Nathanson
Maybe try closing the option tag?

option class=parentMenu/option

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of rob
Sent: Thursday, December 10, 2009 12:54 PM
To: jQuery (English)
Subject: [jQuery] Selectors and Internet Explorer

I'm having some problem with selectors in Internet Explorer.  I have
this demo setup that is basically a modified linked menus
application.  When you select something from one menu, it updates the
contents in it's child menu.

For some reason Internet Explorer will not read the correct selector.

I have tested the following:  I've tried each of these selectors with
and without this.
$(.parentMenu).click();
$(#parentMenu  .parentMenu).click();
$(#parentMenu  option).click();

This was the only one I got to trigger anything.
$(#parentMenu).click();

The elements in question here are:
select class='selectMenu' id='parentMenu'
option class='parentMenu'
/select

My question is:

Why do all the other browsers recognize the content within the
select except internet explorer.  It seems like it won't call any of
the option elements, whether they're created by script or loaded fresh
from the server.

Any ideas??



RE: [jQuery] Can't get image's dimension under a hidden object

2009-11-19 Thread Josh Nathanson
One little trick I've used is to use absolute positioning to move the image
way off the page, like left = -5000, then display the image, get the
dimensions, then hide it again.  This way your layout won't be disturbed.

 

-- Josh

 

 

 

From: Michael Geary [mailto:m...@mg.to] 
Sent: Thursday, November 19, 2009 9:39 AM
To: jquery-en@googlegroups.com
Subject: Re: [jQuery] Can't get image's dimension under a hidden object

 

I don't think even case 1 will work in all browsers. Some browsers won't
bother loading the image if it has display:none. But they will all load it
if it has visibility:hidden.

Here's how I do it:

jQuery.imageDimensions = function( src, callback ) {
jQuery('img /')
.css({ visibility:'hidden' })
.appendTo('body')
.load( function() {
var width = this.width;
var height = this.height;
jQuery(this).remove();
callback( width, height );
})
.attr({ src:src });
};

and then use:

$.imageDimensions( 'xxx', function( width, height ) {
// here you have the image width and height
});

That's a little different from what you're doing - I'm not working with an
IMG tag already in the document - but if you pull the src attribute from the
img tag and pass it to this function it should work.

-Mike

On Thu, Nov 19, 2009 at 7:16 AM, David .Wu chan1...@gmail.com wrote:

1.
img src=xxx id=img1 style=display: none; /
$(window).load(function() {
   alert($('#img1').width());
});

2.
div style=display: none;
   img src=xxx id=img2 style=display: none; /
/div
$(window).load(function() {
   alert($('#img2').width());
});

case 1 can get the dimension, but case 2 can't, how to get it?

 



[jQuery] Re: Single page application and jQuery

2009-09-22 Thread Josh Nathanson

Hi Phaedra,

Probably, most people don't pay much attention to memory leakage when they
are creating applications, or they don't test on IE.

A quick scan of the jQuery bug tracker shows a few bug reports that relate
to the leakage in IE.  It doesn't look like they've been resolved.

You might want to try and isolate the parts of your application that are
leaking memory, and use plain 'ol javascript in those parts.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Phaedra
Sent: Tuesday, September 22, 2009 12:05 PM
To: jQuery (English)
Subject: [jQuery] Re: Single page application and jQuery


So, no one looking at this topic? or no one know nothing about?



[jQuery] Re: jQuery select where attribute ID less than

2009-08-31 Thread Josh Nathanson

Any chance of doing what you need to do on the server, rather than the
client?

Are you stuck with the naming convention you're using, or can you name the
spans a little differently or give them different class names to allow for
better selection criteria?

Given your current situation you'd have to loop through each span as Aquaone
said, but I bet you might be able to think of a different way to approach
the problem.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Namir
Sent: Monday, August 31, 2009 2:33 PM
To: jQuery (English)
Subject: [jQuery] Re: jQuery select where attribute ID less than


Still how would I do it with an each? I'd still need to select all the
ones with an attribute of less than x, and it would be stupid to loop
it from 1 to whatever as x can reach thousands. Do you have any other
suggestions as to how I could do this?

On Aug 31, 9:58 pm, aquaone aqua...@gmail.com wrote:
 id will be a string. AFAIK there's no built-in to parse it as a number and
 compare. you'd either have to .each() it or find another means of
 accomplishing what you are trying to do.

 aquaone



 On Mon, Aug 31, 2009 at 13:50, Namir namiras...@hotmail.com wrote:

  How can I do a less than in a select e.g. something like $.(span.class
  [id+ a_custom_variable +]) when I tried that it just selected all
  span of class with an ID attribute rather than where ID attribute is
  less than



[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Josh Nathanson

Rick - the load method is asynchronous, so you have to get the html from
#favoritesHold in a callback from the load method.  Otherwise, the
subsequent code after the load method is running before the html is returned
from the server.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Wednesday, August 19, 2009 3:02 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is this sytax legitimate?


Hmmm...tried that and couldn't get it to work...something strange is going
on.

Tried this sequence, too:

var favoritesHTML = '../components/userFavoritesHTML.cfm?' + new
Date().getTime();

$('#noFavorites:visible').hide();


$('#favoritesHold').load(favoritesHTML);

var newHTML = $('#favoritesHold').html();

$('.menu1').append(newHTML);

I can see the HTML on the screen in the #favoritesHold in the second line of
code above,
but nothing gets appended to .menu1.

Any other suggestions?

Rick



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of ak732
Sent: Wednesday, August 19, 2009 4:22 PM
To: jQuery (English)
Subject: [jQuery] Re: Is this sytax legitimate?


Actually,  this would be better I think:

$(.menu1).append($(div/).load(favoritesHTML).html());

The idea being to consruct a temp placeholder for your loaded html
that goes away after.

On Aug 19, 4:18 pm, ak732 ask...@gmail.com wrote:
 The syntax looks okay.

 Are you using Firebug to verify that #favorites (which appears to be a
 mysterious li somewhere) is actually being loaded as you expect?
 Does it actually contain the li tags you show above?

 Also, you might want to eliminate #favorites altogether by taking a
 page from jQuery's load implmentation like this:

 $(div/).load(favoritesHTML).html().appendTo(.menu1);



[jQuery] Re: How can I modify this code to get the tooltip to disappear?

2009-08-18 Thread Josh Nathanson
Rick:  I think in your mouseout binding, you also need to unbind the
mousemove event handler from the document.  I think would look like this:

 

$('.clickable').mouseout(function() {

$().unbind( 'mousemove' );

$('div.toolTip').remove();

});

 

-- Josh

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 18, 2009 10:43 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How can I modify this code to get the tooltip to
disappear?

 

I've got it appearing at the correct time and following the mouse pointer
correctly.

 

But my last bit of code isn't causing the tip to be removed.

 

Is it because the first section of code below is being triggered with every
mouse movement?

 

If so, how should I reconfigure this routine.?

 

Thanks for any feedback.

 

CODE:

 

 $(document).ready(function() {

 

  $('.clickable').mouseover(function() {

 

   $().mousemove(function(event) {

   

$('div class=toolTipYou must have a favorites
accountbrand be logged in to save favorites/div').appendTo('body');

   

$('div.toolTip').css({ 'top' : event.pageY - 5, 'left' :
event.pageX + 20 });

   

$('div.toolTip').show();

   

   });

  });

   

  $('.clickable').mouseout(function() {

   

   $('div.toolTip').remove();

   

  });

 });

 


--

Ninety percent of the politicians give the other ten percent a bad
reputation.  - Henry Kissinger

 



[jQuery] Re: $.jgrid is undefined with jqgrid plugin

2009-08-04 Thread Josh Nathanson

I think that plugin is broken.  I tried it a couple of weeks back and got
the same error, tried to debug it for a while, and gave up.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Massimiliano Marini
Sent: Tuesday, August 04, 2009 11:11 AM
To: jQuery (English)
Subject: [jQuery] $.jgrid is undefined with jqgrid plugin


Error: $.jgrid is undefined
Source file: http://localhost/test/js/jquery.jqGrid.min.js

I don't understand why I get this error.

http://trirand.com/jqgrid/jqgrid.html

Cheers



[jQuery] Re: BlockUI 1.33 crashing Internet Explorer

2009-07-15 Thread Josh Nathanson

Try upgrading to jQuery 1.3.2 and BlockUI 2.0.  Your versions are somewhat
outdated.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of JQUser
Sent: Wednesday, July 15, 2009 10:08 AM
To: jQuery (English)
Subject: [jQuery] BlockUI 1.33 crashing Internet Explorer


I am using the BlockUI Plugin version 1.33 with Jquery Version 1.2.1.

When the application page is accessed in which the block and unblock
UI calls are executed, IE is crashing randomly.

Pls help what needs to be done to overcome this issue.



[jQuery] Re: function scope

2009-07-06 Thread Josh Nathanson

You can't.  You'll have to create a global variable outside document.ready:

var myFuncs = {};

$(document).ready(function() {
myFuncs.foo = function() {
// etc.
};
});

other .js file:
myFuncs.foo();

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of tecmo
Sent: Monday, July 06, 2009 5:11 PM
To: jQuery (English)
Subject: [jQuery] function scope


In my $(document).ready(function() I have

function foo() {}

How can I access the foo function from a different jquery .js file?

thank you, very new
- eric



[jQuery] Re: ready() to bind post-ajax events

2009-07-04 Thread Josh Nathanson


Would there be a racing issue with html() though?  I believe that is not an 
asynchronous method, so it would have to complete before the next chained 
method.


-- Josh


- Original Message - 
From: hedgomatic hedgoma...@gmail.com

To: jQuery (English) jquery-en@googlegroups.com
Sent: Saturday, July 04, 2009 9:34 AM
Subject: [jQuery] ready() to bind post-ajax events




I haven't seen much mention of this on the web, and only recently
discovered it works not sure if this is somehow bad practice or
just a lesser known trick, but lately I've been chaining .ready() at
the end of .html() when I want to bind events to new ajax data... I
presume it's much more efficient than live(), and avoids racing
issues. EG:


$.ajax({
   type: 'POST',
   url: 'myPage.html',
   success: function(c){
$(.response).html(c).ready(function() {
bindNewEvent(.response a);

 });
});

function bindNewEvent(o) {
$(o).click(funciton() {  ...etc...  });
};



There's infinite docs about using .ready() to process the document,
but not returning HTML. Passing the above along should anyone find it
useful or have insight onto why it's seemingly not mentioned elsewhere. 




[jQuery] Re: When DOM elements are created and inserted into the document

2009-06-30 Thread Josh Nathanson

The LiveQuery plugin allows you to do this.  Do a search for LiveQuery in
the jQuery plugins area.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Khai
Sent: Tuesday, June 30, 2009 5:34 PM
To: jQuery (English)
Subject: [jQuery] When DOM elements are created and inserted into the
document


Hello,

I want to be able to run a function every time an element is removed
on inserted into the document.  How can I do this?

Thanks!

Khai



[jQuery] Re: matching full names when querying

2009-05-28 Thread Josh Nathanson
It doesn't match on partials unless you use special selector symbols.

 

The reason your element is matched is because the class myDiv on your div
matches the $(.myDiv) part of your selector.  It is not because of the
partial match.  When you do a comma delimited list as a selector, an element
matching anything in the list will be retrieved.  So your selector .myDiv,
#my would match any elements with the id my OR the class myDiv.

 

If you just want to search for the id you'd do this:

$(#myID)

 

-- Josh

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Peter Marino
Sent: Thursday, May 28, 2009 10:35 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] matching full names when querying

 

Hi jQuery people,

 

I just found out that jQuery can match on partials,.. is this correct?

and if so how do I make it match on the whole text.

 

i.e.

 

div id=myID class=myDiv /

 

doing a $(.myDiv, #my) will actually match the above tag! is this correct?

if so how do I force it to match the whole myID instead of partials?

 

regards,

Peter

-- 
Power Tumbling - http://www.powertumbling.dk
OSG-Help - http://osghelp.com



[jQuery] Re: Tablesorter is not enabled on my page

2009-05-27 Thread Josh Nathanson

Try clicking twice on a header.  The first click won't appear to do anything
if the table is already sorted.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of bayadmin
Sent: Wednesday, May 27, 2009 1:30 PM
To: jQuery (English)
Subject: [jQuery] Re: Tablesorter is not enabled on my page


HmmI tried those, too. I changed both the function and table to
another example given in the documentation:

1) the  scripts and function in the header.php:

script type=text/javascript src=library/scripts/jquery-
latest.js/script 
script type=text/javascript src=library/scripts/
jquery.tablesorter.js/script 

script type=text/javascript id=js

$(document).ready(function() {
// call the tablesorter plugin
$(table).tablesorter();
});

/script
?php

wp_head(); ?

/head

2) The table itself.

table class=tablesorter cellspacing=1
thead
tr
thfirst name/th
thlast name/th
thage/th
thtotal/th
thdiscount/th
thdiff/th
/tr
/thead
tbody
tr
tdpeter/td
tdparker/td
td28/td
td9.99/td
td20.3%/td
td+3/td
/tr
tr
tdjohn/td
tdhood/td
td33/td
td19.99/td
td25.1%/td
td-7/td
/tr
/tbody
/table

Still no difference. -Amy

On May 27, 1:16 pm, GaVrA ga...@crtaci.info wrote:
 Ehh... Faster then me for 3min... :P

 On May 27, 10:11 pm, Jonathan jdd...@gmail.com wrote:

  the ID 1 is invalid.

  Seehttp://www.w3.org/TR/REC-html40/types.html#type-name

  On May 27, 10:26 am, bayadmin admin.baynet...@gmail.com wrote:

   Hello, I am trying out the Tablesorter in Wordpress 2.7.1  to make a
   membership list sortable. For some reason the sortable features isn't
   being enabled (or at least visible). I need help find the culprit.
   Here are the steps I've taken so far:

   1)
   In the header.php file I added the following code between the head
   tags:

   head
   script type=text/javascript src=library/scripts/jquery-
   latest.js/script
   script type=text/javascript src=library/scripts/
   jquery.tablesorter.js/script

   ?php

   wp_head(); ?

   /head

   (the scripts directory is located at /wp/wp-content/themes/mytheme/
   library/scripts/)

   2)
   and in the jquery.tablesorter.js script I added the following code
   just below the comments at the top:
  
(perhttp://www.nabble.com/Tablesorter-Into-Wordpress-page-td21007774.htm)

   $(document).ready(function()
       {
           $(1).tablesorter( {sortList: [[0,0], [1,0]]} );
       }
   );

   (I tried putting this function in the header itself, as
whathttp://tablesorter.com/docs/#Getting-Startedseemtobe saying, but
   this had only the effect of displaying this code on the page itself.)

   3)
   On the page with the table, I used the same sample table
fromhttp://tablesorter.com/docs/#Getting-Started, using 1 for the ID.

   table id=1
   thead
   tr
       thLast Name/th
       thFirst Name/th
       thEmail/th
       thDue/th
       thWeb Site/th
   /tr
   /thead
   tbody
   tr
       tdSmith/td
       tdJohn/td
       tdjsm...@gmail.com/td
       td$50.00/td
       tdhttp://www.jsmith.com/td
   /tr
   tr
       tdBach/td
       tdFrank/td
       tdfb...@yahoo.com/td
       td$50.00/td
       tdhttp://www.frank.com/td
   /tr
   /tbody
   /table

   But, while the table shows up on the page, the sortable features are
   not visible.

   NOTE: In Wordpress  I have the WP-Table Reloaded plugin activated, but
   to trouble shoot this issue, I am not using the shortcode and using a
   HTML table directly in the page, for now.

   Please advise what I need to do to fix this?

   Thanks!
   Amy



[jQuery] Re: Read Pro JavaScript Techniques?

2009-05-22 Thread Josh Nathanson

I would very highly recommend it.  It's written by the creator of jQuery
John Resig.

Is this Michael Finney from Seven on Your Side?

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of finneycanhelp
Sent: Friday, May 22, 2009 8:13 AM
To: jQuery (English)
Subject: [jQuery] Read Pro JavaScript Techniques?


Have you read the book Pro JavaScript Techniques Published December
2006? Still good /  applicable?

(book image and links at http://jspro.org/ )

Do you know of an active and better email list (or discussion group)
for such general JavaScript questions?

Thanks.

Michael Finney



[jQuery] Re: SOT: execute JS before a specific image loads

2009-05-20 Thread Josh Nathanson
Andy,

Dunno if you can do thatcurious though, could you just do an ajax call
that gives you the extra stuff?  It won't fire if they don't have
javascript present, so it would do pretty much the same thing.

-- Josh



_
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Andy Matthews
Sent: Wednesday, May 20, 2009 8:52 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] SOT: execute JS before a specific image loads



Can I intercept the loading of an image BEFORE it loads?

We're looking at using an img tag for inserting stats on our server. Here's
what I'm considering...

1) Collect certain information server side, write an img to the document
like so (note the URL vars):

img id=statsImg src=stats.cfm?somevar=someval width=1 height=1 /

2) Using JS, intercept the load of this image BEFORE it takes place, and add
things to the URL vars.

This way, if JS is not present, you get the default stuff, but if JS is
present, you get extra stuff.

Anyone?

Andy Matthews
Senior Web Developer
  OLE Object: Picture (Metafile)  
www.dealerskins.com

P Please consider the environment before printing this e-mail.

Total customer satisfaction is my number 1 priority! If you are not
completely satisfied with
the service I have provided, please let me know right away so I can correct
the problem,
or notify my manager Aaron West at aw...@dealerskins.com.

attachment: winmail.dat

[jQuery] Re: Event is not triggered when the tr removed from one table to another table

2009-05-18 Thread Josh Nathanson

Events are not automatically bound to new elements added to the dom.
However if you are using jquery 1.3+ you can do this to achieve dynamic
binding:

$(tr).live(dblclick,function(event) {
// etc.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of naresh
Sent: Monday, May 18, 2009 11:05 AM
To: jQuery (English)
Subject: [jQuery] Event is not triggered when the tr removed from one
table to another table


Hi I have a query(JQuery) here. can you plz help me in fixing the
issue with this code.

That is when I click on tr of first table that should get removed
from first table and added to second table. It is happening fine and
good. But when I double click on the tr that is added to second
table no event is triggered. Why?

$(tr).dblclick(function(event){
var row = $(this).html();
$(this).remove();
$(#bottomTable).append(tr+row+/tr);
});

do I need to call any method?



[jQuery] Re: jquery.getJSON params not filtering

2009-05-14 Thread Josh Nathanson

I think your params should look like this:

{ category:fundType }

In your code, you are passing a string rather than a javascript object
literal.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of bradrice
Sent: Thursday, May 14, 2009 9:38 AM
To: jQuery (English)
Subject: [jQuery] jquery.getJSON params not filtering


I just can't seem to get getJSON to filter based upon the map I send
in.

Here is my code:

$.getJSON('funds_static_json.dot',{category:fundType},function(json)
{
dropdownSet.loadSelect(json);
}

My post in firebug looks completely right:

http://www.uakron.edu/development2/funds/funds_static_json.dot?category=5263
60

The json is formatted properly and passes the lint test.

However, I get the entire json back and not the filtered by my
parameter. I have over a thousand funds, but it should only pull back
about 9 bassed upon that category.

Here is my working url:
http://www.uakron.edu/development2/funds/fund-detail_2.dot

Any help would be appreciated. I'm slamming into a wall.



[jQuery] Re: jquery.getJSON params not filtering

2009-05-14 Thread Josh Nathanson

I would say then that it's probably your server code.  Maybe run some
debugging and make sure the parameters are coming in as you expect, and look
at the data server side before it goes back to the client.

-- JOsh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of bradrice
Sent: Thursday, May 14, 2009 10:02 AM
To: jQuery (English)
Subject: [jQuery] Re: jquery.getJSON params not filtering


OK, I changed it but it still returns everything. It isn't filtering.
Thanks for the suggestion.

On May 14, 12:54 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 I think your params should look like this:

 { category:fundType }

 In your code, you are passing a string rather than a javascript object
 literal.

 -- Josh

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of bradrice
 Sent: Thursday, May 14, 2009 9:38 AM
 To: jQuery (English)
 Subject: [jQuery] jquery.getJSON params not filtering

 I just can't seem to get getJSON to filter based upon the map I send
 in.

 Here is my code:

 $.getJSON('funds_static_json.dot',{category:fundType},function(json)
 {
                         dropdownSet.loadSelect(json);
                 }

 My post in firebug looks completely right:

 http://www.uakron.edu/development2/funds/funds_static_json.dot?catego...
 60

 The json is formatted properly and passes the lint test.

 However, I get the entire json back and not the filtered by my
 parameter. I have over a thousand funds, but it should only pull back
 about 9 bassed upon that category.

 Here is my working
url:http://www.uakron.edu/development2/funds/fund-detail_2.dot

 Any help would be appreciated. I'm slamming into a wall.



[jQuery] Re: jquery.getJSON params not filtering

2009-05-14 Thread Josh Nathanson

Well...I don't see anything in your code that would filter the JSON once it
comes back from the server.

You are just dumping the response into the select menu.  Once the params are
sent to the server, and the JSON is generated there, there is nothing else
that would happen to create further filtering.

The params in the getJSON function do not provide filtering for the returned
JSON, only keys/values to be passed to the server.

It seems like you might be better served doing the filtering on the server,
that way you do not have to pass back the entire list of funds, only the
ones in the category you send to the server.

-- Josh





-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of bradrice
Sent: Thursday, May 14, 2009 10:45 AM
To: jQuery (English)
Subject: [jQuery] Re: jquery.getJSON params not filtering


I have this in there:

$.ajaxSetup({error:function(XMLHttpRequest,textStatus, errorThrown)
{
  alert(textStatus);
  alert(errorThrown);
  alert(XMLHttpRequest.responseText);
  }});

I've got it coming back right. I can see the json on the server and it
is serving correctly.

Like I said I am getting a proper response back and it is populating
the menu, just not filtering on the params I am telling it to filter
on.

On May 14, 1:08 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 I would say then that it's probably your server code.  Maybe run some
 debugging and make sure the parameters are coming in as you expect, and
look
 at the data server side before it goes back to the client.

 -- JOsh

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of bradrice
 Sent: Thursday, May 14, 2009 10:02 AM
 To: jQuery (English)
 Subject: [jQuery] Re: jquery.getJSON params not filtering

 OK, I changed it but it still returns everything. It isn't filtering.
 Thanks for the suggestion.

 On May 14, 12:54 pm, Josh Nathanson joshnathan...@gmail.com wrote:
  I think your params should look like this:

  { category:fundType }

  In your code, you are passing a string rather than a javascript object
  literal.

  -- Josh

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

  Behalf Of bradrice
  Sent: Thursday, May 14, 2009 9:38 AM
  To: jQuery (English)
  Subject: [jQuery] jquery.getJSON params not filtering

  I just can't seem to get getJSON to filter based upon the map I send
  in.

  Here is my code:

  $.getJSON('funds_static_json.dot',{category:fundType},function(json)
  {
                          dropdownSet.loadSelect(json);
                  }

  My post in firebug looks completely right:

 http://www.uakron.edu/development2/funds/funds_static_json.dot?catego...
  60

  The json is formatted properly and passes the lint test.

  However, I get the entire json back and not the filtered by my
  parameter. I have over a thousand funds, but it should only pull back
  about 9 bassed upon that category.

  Here is my working
 url:http://www.uakron.edu/development2/funds/fund-detail_2.dot

  Any help would be appreciated. I'm slamming into a wall.



[jQuery] Re: Scoping issue with load and call back function.

2009-05-07 Thread Josh Nathanson

Well it's a little tricky because of the asynchronicity.  The way I might
handle it is to set some kind of isLoaded global object that gets
poplulated each time an async call returns.  You more or less already have
that.  Then, create a polling function using setInterval or setTimeout
that checks every 500ms or so to see if that isLoaded object is completely
populated.  Once you determine that it is, then generate the combined table.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Stever
Sent: Thursday, May 07, 2009 4:28 AM
To: jQuery (English)
Subject: [jQuery] Re: Scoping issue with load and call back function.


Josh,

First the firstload=0 and not resetting the variable was left off. But
ultimately is unrelated to the asynchronous problem you pointed out.

Asynchronous loading makes a big difference here.  As a pretty recent
user of jquery, I obviously designed this code wrong.

So here is what I what to do.   I have multiple web pages on a server
that have summary result tables for different products.
I want to read each of these summary tables and combine the results
into one single table.

My thought was to use Jquery Load to load each table and read the
information and store into the global arrays, TableCell, TableRow and
TableColumn.

Apparently this approach is flawed.

Can you or someone on this group recommend/outline a way to accomplish
this relatively simple task?

Thanks!!

Steve










On May 6, 7:13 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 OK it looks like you have a few things to sort out here.

 One thing is that you have to remember that load is asynchronous.  So when
 that is fired the rest of your code will continue along its merry way.  In
 other words the loop will keep looping independent of the callback
function
 firing.  My hunch is that this will give you unexpected values for the
 variable [i] in the load callback function.  Because of this you will
 probably have to do some refactoring to get the results you're looking
for.
 Not sure though if you intend to run that load on every iteration of the
 loop or just the first one.

 Also you may have left this out, but I see you have a firstload = 1
 declaration, but then you don't set it to 0.  This could also be messing
up
 your results as it will run every time unless you set it to 0 somewhere.

 Definitely leave the variable declarations outside document ready as in
your
 second email.

 -- Josh

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of Stever
 Sent: Wednesday, May 06, 2009 4:31 PM
 To: jQuery (English)
 Subject: [jQuery] Re:Scopingissue with load and call back function.

 Josh thanks for the quick response.

 I tried putting the variables

 var TableCells    =[,];
 var TableRowName  =[,];
 var TableColName  =[,];
  outside the document ready function.  Originally. (not redefined with
 var inside document ready shown here).

 script type=text/javascript src=http://www.hou.asp.ti.com/
 sparcit_data_reports//js/jquery.js/script
 script type=text/javascript
 var devList  = [
                 PART_1
                ];

 var TableCells    =[,];
 var TableRowName  =[,];
 var TableColName  =[,];

 $(document).ready(function(){
   $.ajaxSetup({cache: false}) ;
   var firstLoad = 1;
   for( var i =0; i  devList.length; i++)
   {
     // set the path
     var path = url + devList[i] ;
    var colName =[];
    var rowName =[];
    var cellValue = [];

     //load the page but collect the table info
     if (firstLoad == 1)
     {
       $('#display').load(path,
          function(){
                              manipulate tables and put data in Global
 Array

                                   TableCells[i]   = cellValue;
                                   TableRowName[i] = rowName;
                                   TableColName[i] = colName;

       });
        var lenTable2 = TableColName[i].length;

     }
   }

 });

 So where I try to access the new length of TableColName[i]  I get that
 this variable is undefined.

 Actually while debugging, I find that variable i defined in the loop
 outside the load, is NOT available inside the load function.

 It is all very confusing.

 :-(

 On May 6, 6:10 pm, Josh Nathanson joshnathan...@gmail.com wrote:
  When you say you get undefined outside the load function, do you mean
  outside $(document).ready, or inside $(document).ready?

  They should not be accessible outside document.ready, because of the
 closure
  caused by passing the anonymous function to document.ready, and because
 you
  use var to declare them inside that function.

  If you want them to be accessible globally, you'll have to declare them
  outside document.ready.

  -- Josh

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

  Behalf Of Stever
  Sent: Wednesday, May 06, 2009 3:54 PM
  To: jQuery (English

[jQuery] Re: Scoping issue with load and call back function.

2009-05-06 Thread Josh Nathanson

When you say you get undefined outside the load function, do you mean
outside $(document).ready, or inside $(document).ready?

They should not be accessible outside document.ready, because of the closure
caused by passing the anonymous function to document.ready, and because you
use var to declare them inside that function.

If you want them to be accessible globally, you'll have to declare them
outside document.ready. 

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Stever
Sent: Wednesday, May 06, 2009 3:54 PM
To: jQuery (English)
Subject: [jQuery] Scoping issue with load and call back function.


I am a relative newbie to Jquery and I am getting some scoping issues
I can't figure out.

I was hoping for some advice.

Basically I am trying to load multiple documents that have HTML tables
and then parse the tables and redisplay in a new format. Merging
elements from the different documents.


So basically I build the url path for a set of devices  and load
them. I thought in the load function I could collect elements into
global variables and manipulate in the final document. But is not
working.

The variables TableCells, TableRowName and TableColName are what I
have issues with.


$(document).ready(function(){
  $.ajaxSetup({cache: false}) ;

  var TableCells=[,];
  var TableRowName  =[,];
  var TableColName  =[,];

 for( var i =0; i  devList.length; i++)
  {
// set the path
var path = prefix + yield_dir + devList[i] +'/' + smslot_yield;
//clear the display area
$('#display').html();

   var colName =[];
   var rowName =[];
   var cellValue = [];

//load the page but collect the table info
if (firstLoad == 1)
{

  $('#display').load(path,
   function(){


 manipulate tables and put data in
Global Array
  TableCells[i]   = cellValue;
  TableRowName[i] = rowName;
  TableColName[i] = colName;


});
}
  }
});



So the variables are defined in the document ready scope. (I even
tried outside that as well)
 var TableCells=[,];
 var TableRowName  =[,];
 var TableColName  =[,];

I set these variables in the load function scope and they are
accessible there and work fine.

However when I try to access outside the load function the variables
are undefined.

Can you tell what I am missing?

Thanks,

Steve



[jQuery] Re: Scoping issue with load and call back function.

2009-05-06 Thread Josh Nathanson

OK it looks like you have a few things to sort out here.

One thing is that you have to remember that load is asynchronous.  So when
that is fired the rest of your code will continue along its merry way.  In
other words the loop will keep looping independent of the callback function
firing.  My hunch is that this will give you unexpected values for the
variable [i] in the load callback function.  Because of this you will
probably have to do some refactoring to get the results you're looking for.
Not sure though if you intend to run that load on every iteration of the
loop or just the first one.

Also you may have left this out, but I see you have a firstload = 1
declaration, but then you don't set it to 0.  This could also be messing up
your results as it will run every time unless you set it to 0 somewhere.

Definitely leave the variable declarations outside document ready as in your
second email.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Stever
Sent: Wednesday, May 06, 2009 4:31 PM
To: jQuery (English)
Subject: [jQuery] Re: Scoping issue with load and call back function.


Josh thanks for the quick response.

I tried putting the variables

var TableCells=[,];
var TableRowName  =[,];
var TableColName  =[,];
 outside the document ready function.  Originally. (not redefined with
var inside document ready shown here).


script type=text/javascript src=http://www.hou.asp.ti.com/
sparcit_data_reports//js/jquery.js/script
script type=text/javascript
var devList  = [
PART_1
   ];

var TableCells=[,];
var TableRowName  =[,];
var TableColName  =[,];

$(document).ready(function(){
  $.ajaxSetup({cache: false}) ;
  var firstLoad = 1;
  for( var i =0; i  devList.length; i++)
  {
// set the path
var path = url + devList[i] ;
   var colName =[];
   var rowName =[];
   var cellValue = [];

//load the page but collect the table info
if (firstLoad == 1)
{
  $('#display').load(path,
 function(){
 manipulate tables and put data in Global
Array

  TableCells[i]   = cellValue;
  TableRowName[i] = rowName;
  TableColName[i] = colName;

  });
   var lenTable2 = TableColName[i].length;

}
  }

});


So where I try to access the new length of TableColName[i]  I get that
this variable is undefined.

Actually while debugging, I find that variable i defined in the loop
outside the load, is NOT available inside the load function.

It is all very confusing.

:-(



On May 6, 6:10 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 When you say you get undefined outside the load function, do you mean
 outside $(document).ready, or inside $(document).ready?

 They should not be accessible outside document.ready, because of the
closure
 caused by passing the anonymous function to document.ready, and because
you
 use var to declare them inside that function.

 If you want them to be accessible globally, you'll have to declare them
 outside document.ready.

 -- Josh

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of Stever
 Sent: Wednesday, May 06, 2009 3:54 PM
 To: jQuery (English)
 Subject: [jQuery]Scopingissuewith load and call back function.

 I am a relative newbie to Jquery and I am getting somescopingissues
 I can't figure out.

 I was hoping for some advice.

 Basically I am trying to load multiple documents that have HTML tables
 and then parse the tables and redisplay in a new format. Merging
 elements from the different documents.

 So basically I build the url path for a set of devices  and load
 them. I thought in the load function I could collect elements into
 global variables and manipulate in the final document. But is not
 working.

 The variables TableCells, TableRowName and TableColName are what I
 have issues with.

 $(document).ready(function(){
   $.ajaxSetup({cache: false}) ;

   var TableCells    =[,];
   var TableRowName  =[,];
   var TableColName  =[,];

  for( var i =0; i  devList.length; i++)
   {
     // set the path
     var path = prefix + yield_dir + devList[i] +'/' + smslot_yield;
     //clear the display area
     $('#display').html();

    var colName =[];
    var rowName =[];
    var cellValue = [];

     //load the page but collect the table info
     if (firstLoad == 1)
     {

       $('#display').load(path,
                                function(){

                                  manipulate tables and put data in
 Global Array
                                   TableCells[i]   = cellValue;
                                   TableRowName[i] = rowName;
                                   TableColName[i] = colName;

                                 });
     }
   }
 });

 So the variables are defined in the document ready scope. (I even
 tried outside

[jQuery] Re: passing more than 1 param via click()?

2009-04-16 Thread Josh Nathanson

You could do something like:

a rel=val1_val2 // use a delimiter that makes sense for your values

Then split the rel:

var arr = this.rel.split('_'), val1 = arr[0], val2 = arr[1];

removeDept( val1, val2 );

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of kgosser
Sent: Thursday, April 16, 2009 2:47 PM
To: jQuery (English)
Subject: [jQuery] passing more than 1 param via click()?


Hey all,

Not really sure how to ask this, so I'm sorry if my title is mis-
leading. It is also why I wasn't able to find much searching, so I'm
sorry if it's answered already.

Basically, the code I inherited was this:

a
 href=#drop
 class=edit-link
 onclick=
  removeDept('c:out value=${key} /','c:out value=$
{name} /');
  return false;
Remove Department/a

And that is in an iteration, so the two values passed to the
removeDept function are always dynamic.

I'm trying to handle this in the document.ready(). Normally, I throw
the would-be dynamic param passed as a rel tag on an anchor, and
that's how I retrieve things when I clean up code like this.

However, I'm scratching my head for the *best* way to handle this with
the two params now... How do you guys recommend I handle something
like that?

$(document).ready(function() {
$(.edit-link).click(function(){
   removeDept($(this).attr(rel),$(this).attr(rel));
   return false;
});
});



Obviously I can't have two rel attributes :)


Thanks in advance.



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

2009-02-25 Thread Josh Nathanson

 First, I *assume* these two statements are identical in performance:
 $(p, $(#foo)) == $(p, #foo)

No -- the first one calls jQuery three times, the second one twice.  Big
difference.

Now, I'm not sure about if it's faster to use find() than the context
selector.  I would think under the hood it's doing the same thing, and the
context argument is just a handy shortcut.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Kevin Dalman
Sent: Wednesday, February 25, 2009 10:41 AM
To: jQuery (English)
Subject: [jQuery] Re: $('#foo p') or $('p', $('#foo'))


John wrote: You should always use $(#foo).find(p) in favor of $
(p, $(#foo)) 

I'm trying to extrapolate some general concepts from this 'rule'...


If so, then does it matter what the scope selector is? What if the
scope is *not an ID*, and therefore not as fast to find, like::

$(div.myClass).find(p) in favor of $(p, div.myClass) ???

If this is still true, then my understanding is that $(a).find(b)
syntax is ALWAYS faster than $(a, b)???

IF it is true that find() is always faster - or at least equal - to
specifying a scope selector/element, then it would seem that jQuery
should simply use the find() flow internally when a scope selector is
specfied. In other words, when a scope selector/element is specified,
find this element first and then 'call' the same method used for find
() - ie:

*** internally ***
$(p, $(#foo))  ==  $(#foo).find(p)

I can't think of any excepts to this - the result should always be
identical? If so, and performance is equal or superior, then *why not*
do this internally so the two statements above essentially become 100%
identical? It would just be two ways of expressing the same thing,
which is how it appears to users.

Am I off-base here? If so, which assumuption above breaks down?

Even if there is a good reason to treat the syntax differently
internally, I'm still interested to know if I should avoid using scope
selectors in favor of find() ***under all conditions*** - or only
under specific conditions?


/Kevin


On Feb 24, 5:58 pm, John Resig jere...@gmail.com wrote:
 I want to point out a couple things:
 1) You should always use $(#foo).find(p) in favor of $(p, $
 (#foo)) - the second one ends up executing $(...) 3 times total -
 only to arrive at the same result as doing $(#foo).find(p).
 2) I generally dislike saying that there's one good way to do a
 selector (especially with one that has such bad syntax, as above) -
 especially since it may not always be that way.

 In fact, I've already filed a bug and I'll be looking in to this
 issue, possibly resolving it tonight or tomorrow - at which point the
 advice will be false again.http://dev.jquery.com/ticket/4236

 My recommendation is to always write the simplest, easiest to
 understand, expression: jQuery will try to do the rest to optimize it.

 --John

 On Feb 24, 10:23 am, Stephan Veigl stephan.ve...@gmail.com wrote:



  Hi Karl,

  $('#foo').find('p') and $('p', $('#foo')) are approximately of the same
speed.

  I've put the test code on JSBin, so everybody can play around with it
  and try other combinations :-)http://jsbin.com/ifemo

  by(e)
  Stephan

  2009/2/24 Karl Swedberg k...@englishrules.com:

   Hi Stephan,
   Thanks for doing this testing! Would you mind profiling
$('#foo').find('p')
   as well? I suspect it will be roughly equivalent to $('p', $('#foo'))
   Cheers,

   --Karl
   
   Karl Swedberg
  www.englishrules.com
  www.learningjquery.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 and 1.3.2.

   the test HTML consists of 100 ps in a foo div and 900 ps in a
   bar div.

   However the factor differs dramatically:
   In 1.2.6 the speedup from $(p, $(#foo)) to $(#foo p) was between
   1.5x (FF) and 2x (IE),
   while for 1.3.2 the speedup is 20x (FF) and 15x (IE).

   $(p, $(#foo)) is faster in 1.3.2, by a factor of 1.5 (both FF and
IE),
   while $(#foo p) is _slower_ in 1.3.2 by 8.5x (FF) and 4.6x (IE).

   Even with an empty bar div $(p, $(#foo)) is faster by a factor
up to
   3x.

   Conclusion:
   If you have an ID selector, first get the element by it's ID and use
   it as scope for further selects.

   by(e)
   Stephan
   2009/2/23 ricardobeat ricardob...@gmail.com:

   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 that in better detail.

   Anyway, in modern browsers most of the work is being delegated to the

   native querySelectorAll function, as so selector performance will

   become more of a browser makers' concern.

   - ricardo

   On Feb 23, 1:08 pm, Peter Bengtsson 

[jQuery] Re: jQuery.height() or css issue?

2009-02-25 Thread Josh Nathanson

I bet it's the css reset.  There's some funky business with the line-height
on the body tag.  Did you try it without that css reset and see if it gets
better results?

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of chief
Sent: Wednesday, February 25, 2009 8:12 AM
To: jQuery (English)
Subject: [jQuery] jQuery.height() or css issue?


So I have been trying to figure out this issue for a few days now.
Forgive me if it's something super simple that I am missing.

I have a super-simple XHTML 1.0 transitional page (that validates),
using Eric Meyer's CSS reset, and loading the latest jQuery from
Google's site. Then I have two simple divs inside a container div
(nothing floated) and above the container I have a div with a
paragraph in it that gets appended with the height of each of the two
divs upon document load. The thing is I am getting wildly different
numbers in different browsers.

Here is a screenshot of what I am talking about:
http://chief.fishbucket.com/jquery/heightissue.jpg

And you can check out the actual page/code here:
http://chief.fishbucket.com/jquery/

So is this a jQuery bug, or a CSS/browser issue?

Thanks for any help on this - it's been driving me insane.

-chief



[jQuery] Re: default value of an object's property

2009-02-18 Thread Josh Nathanson

I think this might work, give it a try:

Obj.sortby = Obj.sortby || 'time';

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Alexandre Plennevaux
Sent: Wednesday, February 18, 2009 9:07 AM
To: Jquery-en
Subject: [jQuery] default value of an object's property


hi there,

a quick question: i'm using an object to pass a series of variables.
Sometimes, i test for a specific property, which might not exist.
I can't seem to find the right way, i tried

 Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby==''
||Obj.sortby == null) ? 'time' : Obj.sortby;


but everytime that property sortby hasn't been set, firebug returns
it as null

can you clear that up for me?

Thanks a lot!

Alexandre



[jQuery] Re: How to make an element *not* have a function attached...

2009-02-13 Thread Josh Nathanson

This should work:

$('#myTextarea').unbind(); // unbinds all handlers

Then when you want to bind it again:

$('#myTextarea').expandable();

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Friday, February 13, 2009 11:43 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make an element *not* have a function
attached...


To answer your question, hopefully, the element, in this case a textarea,
is set up like this:

script

 $(function() {
  $('#myTextarea').expandable();
});

/script

...and that's it.  It would be active as expandable all the time.

So, there's no event, like click, etc., that triggers the function.

However, I want to be able to click a link and disable the expandable
functionality, until another link is clicked to re-enable the functionality.

In other words, having the textarea expandable is not something I want
on all the time.


 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Frederik Ring
 Sent: Friday, February 13, 2009 2:04 PM
 To: jQuery (English)
 Subject: [jQuery] Re: How to make an element *not* have a function
attached...
 
 
 This should be done using $(this).unbind(event,function).
 I don't know from your example how your handle the event so I cannot
 give you a more specific answer.
 
 On Feb 13, 7:57 pm, Rick Faircloth r...@whitestonemedia.com wrote:
  Strange question, perhaps...but...
 
  If I have an element that has an function from a plug-in
  attached to it, such as:
 
  $(function() {
          $('#myTextarea').expandable();
 
  });
 
  How would I then be able to make #myTextarea not .expandable...
 
  $('#myTextarea').expandable('disable'); ...
 
  Is this something that can be controlled from the page code, or
  does something have to be built into the plug-in to allow this?
 
  Thanks,
 
  Rick



[jQuery] Re: Accessing a JSON property from an unknown variable?

2009-02-13 Thread Josh Nathanson

foo[fooProp] // returns barVal

Is that what you mean?

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Nic
Sent: Friday, February 13, 2009 4:06 PM
To: jQuery (English)
Subject: [jQuery] Accessing a JSON property from an unknown variable?


For instance,

var foo = {
bar: barVal,
baz: bazVal
}

var fooProp = bar;

How can I access barVal through fooProp?

I know this isn't exactly jQuery group discussion but I figured since
it was part of a jQuery system I could get away with it. Thanks!



[jQuery] Re: jQuery w ajaxCFC

2009-02-13 Thread Josh Nathanson

Do a search for jquery coldfusion ajax on Google, you'll find some good
stuff.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Neil Bailey
Sent: Friday, February 13, 2009 3:05 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] jQuery w ajaxCFC


We are currently running CF7 (management feels if it ain't broke), and
have been using ajaxCFC for about three years now.  We are looking to update
our AJAX methodology, and Chris Jordan had strongly suggested we check out
jQuery.

We are also pretty entrenched w/ EXT for the front end UI, and would need
any jQuery scripts to be able to co-exist w/ the EXT package.

As we have never even laid eyes on jQuery, but have heard some very good
things about it (Ray Camden has been yelling its virtues from the rooftops
for a solid week now), if anyone has any tips or knows of any how-to blogs,
I would greatly appreciate it.

Thanks,

nb




[jQuery] Re: Would some please tell me what's wrong with this syntax?

2009-02-13 Thread Josh Nathanson

You don't need that open parenthesis after 'click':

$('.cancel').livequery('click', function() {
...etc.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Friday, February 13, 2009 4:38 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Would some please tell me what's wrong with this syntax?


I'm getting this error:

missing ) after argument list
 return false;\n

from this code:


$(document).ready(function() {

 $('.cancel').livequery('click', (function() {

  $(this).parent().parent().find('.select-div').hide();
  $(this).parent().hide();
  $(this).parent().parent().find('.last-name').fadeIn(500);
  $(this).parent().parent().find('.first-name').fadeIn(500);
  $(this).parent().parent().find('.change-div').fadeIn(500);

 })
 return false;
 );
});

I've tried every variation I can think of and can't get rid of the error...

Thanks,

Rick



[jQuery] Re: jQuery w ajaxCFC

2009-02-13 Thread Josh Nathanson

Really you don't need AjaxCFC at all.  It does have a cfc to serialize and
deserialize json but I think you can pick that up at riaforge.  Or you can
build your own json string in CF and return that from your function.  Or you
can use returnFormat=JSON in your cffunction to do the serialization for
you.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Neil Bailey
Sent: Friday, February 13, 2009 5:16 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: jQuery w ajaxCFC


Josh,

Just found the page at Rey Bango's blog - I really appreciate it.

Do you know if this works w/ the current version of jQuery, and the current
version of AjaxCFC?

Thanks again.

nb

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Josh Nathanson
Sent: Friday, February 13, 2009 8:02 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: jQuery w ajaxCFC


Do a search for jquery coldfusion ajax on Google, you'll find some good
stuff.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Neil Bailey
Sent: Friday, February 13, 2009 3:05 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] jQuery w ajaxCFC


We are currently running CF7 (management feels if it ain't broke), and
have been using ajaxCFC for about three years now.  We are looking to update
our AJAX methodology, and Chris Jordan had strongly suggested we check out
jQuery.

We are also pretty entrenched w/ EXT for the front end UI, and would need
any jQuery scripts to be able to co-exist w/ the EXT package.

As we have never even laid eyes on jQuery, but have heard some very good
things about it (Ray Camden has been yelling its virtues from the rooftops
for a solid week now), if anyone has any tips or knows of any how-to blogs,
I would greatly appreciate it.

Thanks,

nb







[jQuery] Re: jqURL plugin throwing JS errors

2009-02-06 Thread Josh Nathanson
Andy - that's my plugin - do you have a link I could look at?

-- Josh



_
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Andy Matthews
Sent: Friday, February 06, 2009 9:50 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] jqURL plugin throwing JS errors


Is there anyone using the jqURL plugin who has noticed errors on page load?
All of a sudden I've noticed the following error:

Permission denied to get property XULElement.accessibleType, line 139
'width=' + args.w + ',height=' + arg...eft=' + args.l +
',scrollbars,resizable'

The implementation:
// open the media library in a new window
$.jqURL.loc(

dspPhotoAdministration.cfm?category=4process=admincouponSelect=true,{
w:750,
h:750,
target:'imageSelect'
});

It's tied to the click event on an IMG tag, and event still works...I'm just
getting tired of seeing the error.


Andy Matthews
Senior Web Developer
  OLE Object: Picture (Metafile)  
www.dealerskins.com

P Please consider the environment before printing this e-mail.

Total customer satisfaction is my number 1 priority! If you are not
completely satisfied with
the service I have provided, please let me know right away so I can correct
the problem,
or notify my manager Aaron West at aw...@dealerskins.com.

attachment: winmail.dat

[jQuery] Re: jqURL plugin throwing JS errors

2009-02-06 Thread Josh Nathanson
Hey Andy - looks like this might be a Firebug bug - read down to the bottom
of this link:

http://code.google.com/p/fbug/issues/detail?id=581

-- Josh



_
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Andy Matthews
Sent: Friday, February 06, 2009 11:01 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: jqURL plugin throwing JS errors


Unfortunately it's in an administration area. I could provide some code for
you though if that would help.


andy

_ 
From:   jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]  On
Behalf Of Josh Nathanson
Sent:   Friday, February 06, 2009 12:10 PM
To: jquery-en@googlegroups.com
Subject:[jQuery] Re: jqURL plugin throwing JS errors

Andy - that's my plugin - do you have a link I could look at?

-- Josh



_
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Andy Matthews
Sent: Friday, February 06, 2009 9:50 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] jqURL plugin throwing JS errors


Is there anyone using the jqURL plugin who has noticed errors on page load?
All of a sudden I've noticed the following error:

Permission denied to get property XULElement.accessibleType, line 139
'width=' + args.w + ',height=' + arg...eft=' + args.l +
',scrollbars,resizable'

The implementation:
// open the media library in a new window
$.jqURL.loc(

dspPhotoAdministration.cfm?category=4process=admincouponSelect=true,{
w:750,
h:750,
target:'imageSelect'
});

It's tied to the click event on an IMG tag, and event still works...I'm just
getting tired of seeing the error.


Andy Matthews
Senior Web Developer
  OLE Object: Picture (Metafile)  
www.dealerskins.com

P Please consider the environment before printing this e-mail.

Total customer satisfaction is my number 1 priority! If you are not
completely satisfied with
the service I have provided, please let me know right away so I can correct
the problem,
or notify my manager Aaron West at aw...@dealerskins.com.

attachment: winmail.dat

[jQuery] Re: OT: CF-Talk Down?

2009-01-28 Thread Josh Nathanson

Yup down for me too.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Wednesday, January 28, 2009 12:46 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] OT: CF-Talk Down?


Hi, guys...

Pardon the OT, but I'm trying to find out
if the CF-Talk list, which several of the jQuery list
users are on, is down.

I haven't gotten anything since yesterday afternoon
and I noticed that the last message on houseoffusion.com
was from 5pm yesterday.

News?

Rick



[jQuery] Re: Problem with Magnify jQuery plugin in IE7

2009-01-22 Thread Josh Nathanson

Hi Peter,

Josh here, the author of the plugin.  Not sure why it's not working for you,
but one thing I would recommend:

- use a class attribute on all your links that you want to bind to the
plugin - that way you can just call the plugin once and all your links will
be bound:

a href=images/content/tips11.png class=magnify_link id=d11 etc.

Then one binding:
$(a.magnify_link).magnify( your options here );

- also try it with the default options first, then add in your custom
options one by one.

- also you are using png's, not sure if that's the problem but you might
want to test with jpg's or gif's instead.

Hope that helps!

-- Josh





-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of PIT
Sent: Thursday, January 22, 2009 10:38 AM
To: jQuery (English)
Subject: [jQuery] Problem with Magnify jQuery plugin in IE7


Hello,
I have problem to show the big version of the image in IE7, in other
browsers working good.
My website where i use Your plugin is:
http://www.dobrestudium.pl/kurs_paznokci.html.php
In attachement i sending screen of place at site wher i use Magnify.
I apply Magnify at one page to 14 images.

I done all good with documentacion and i don't know why not working,
your website example working in IE7, but my not :(

Please give me some information why it's not working.

Regards,
Peter



[jQuery] Re: Problem with Magnify jQuery plugin in IE7

2009-01-22 Thread Josh Nathanson

Oh, I see another problem.  You have stagePlacement values in your
stageCss option.  StageCss can only have valid CSS attributes, so this will
probably break IE.

StagePlacement is a separate option, so your options should look like this:

$(#d02).magnify({
lensWidth: 27,
lensHeight: 27,
showEvent: 'click',
hideEvent: 'mouseout',
stageCss: { border: '3px solid #CC', padding: '15px'}, 
stagePlacement: 'left'
});
Also - I wouldn't recommend using padding on the stageCss, this could lead
to some funky results.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of PIT
Sent: Thursday, January 22, 2009 10:38 AM
To: jQuery (English)
Subject: [jQuery] Problem with Magnify jQuery plugin in IE7


Hello,
I have problem to show the big version of the image in IE7, in other
browsers working good.
My website where i use Your plugin is:
http://www.dobrestudium.pl/kurs_paznokci.html.php
In attachement i sending screen of place at site wher i use Magnify.
I apply Magnify at one page to 14 images.

I done all good with documentacion and i don't know why not working,
your website example working in IE7, but my not :(

Please give me some information why it's not working.

Regards,
Peter



[jQuery] Re: How to make this work for multiple elements with same class

2009-01-13 Thread Josh Nathanson

Rick - I think you want $(this).parent().hide() rather than prev, and
$(this).parent().next() rather than next().  Prev and next look at the
sibling level.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, January 13, 2009 12:17 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make this work for multiple elements with same
class


Ok...made that change, but no difference in the execution.

Here's the relevant js and html/cf:

$(document).ready(function() {

 $('.update-link').click(function() {

  $(this).prev('.options').hide();
  $(this).next('.update-div').fadeIn(500);

 });
});


div class=options
 [ a href=#tour_url# target=_blankPreview/a ] nbsp;
 [ a class=update-link href='##'Update/a ] nbsp;
 [ a href= ##Delete/a ]
/div


div class=update-div


 divEdit Link:/div
 divinput class=textinput01 update-input size=80
value=#tour_url#/div
 divinput class=update-button type=button value=Update/div


div





 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of MorningZ
 Sent: Tuesday, January 13, 2009 3:05 PM
 To: jQuery (English)
 Subject: [jQuery] Re: How to make this work for multiple elements with
same class
 
 
 to start: you have
 
 $('this')
 
 it should be without the ticks
 
 $(this)
 
 On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote:
  Here's the code that I'm trying to make function
  for multiple links on a page with the class of update-link
 
  How would I change this to make it work for the specific
  .update-link element that I click?
 
                  $(document).ready(function() {
 
                          $('.update-link').click(function() {
 
                                  $('this').prev('.options').hide();
                                 
$('this').next('.update-div').fadeIn(500);
 
                          });
                  });
 
  Thanks,
 
  Rick



[jQuery] Re: How to make this work for multiple elements with same class

2009-01-13 Thread Josh Nathanson

A sneaky way to do it would be to remove the href attribute altogether, and
create a css class that makes the link appear to be hyperlinked:

a.fake-link {
text-decoration: underline;
cursor: pointer;
color: [your link color here]
}

Then add that class to your non-href links as desired.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, January 13, 2009 1:07 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make this work for multiple elements with same
class


Thanks, Josh...

You were almost perfect.  I just needed to add one more .next to the second
line:

$(this).parent().next().next().fadeIn(500);

then it worked.

Another question however, is how to keep the page from going back to the top
every time the Update link is clicked.  I've got two ## as the href because
of
ColdFusion need to have two.  Is that the problem, or is there another
solution?

a class=update-link href='##'Update/a

That's the current code.  Suggestions?

Thanks,

Rick


 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Josh Nathanson
 Sent: Tuesday, January 13, 2009 3:36 PM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: How to make this work for multiple elements with
same class
 
 
 Rick - I think you want $(this).parent().hide() rather than prev, and
 $(this).parent().next() rather than next().  Prev and next look at the
 sibling level.
 
 -- Josh
 
 
 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
 Behalf Of Rick Faircloth
 Sent: Tuesday, January 13, 2009 12:17 PM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: How to make this work for multiple elements with
same
 class
 
 
 Ok...made that change, but no difference in the execution.
 
 Here's the relevant js and html/cf:
 
 $(document).ready(function() {
 
  $('.update-link').click(function() {
 
   $(this).prev('.options').hide();
   $(this).next('.update-div').fadeIn(500);
 
  });
 });
 
 
 div class=options
  [ a href=#tour_url# target=_blankPreview/a ] nbsp;
  [ a class=update-link href='##'Update/a ] nbsp;
  [ a href= ##Delete/a ]
 /div
 
 
 div class=update-div
 
 
  divEdit Link:/div
  divinput class=textinput01 update-input size=80
 value=#tour_url#/div
  divinput class=update-button type=button value=Update/div
 
 
 div
 
 
 
 
 
  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
 Behalf Of MorningZ
  Sent: Tuesday, January 13, 2009 3:05 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make this work for multiple elements with
 same class
 
 
  to start: you have
 
  $('this')
 
  it should be without the ticks
 
  $(this)
 
  On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote:
   Here's the code that I'm trying to make function
   for multiple links on a page with the class of update-link
  
   How would I change this to make it work for the specific
   .update-link element that I click?
  
                   $(document).ready(function() {
  
                           $('.update-link').click(function() {
  
                                   $('this').prev('.options').hide();
  
 $('this').next('.update-div').fadeIn(500);
  
                           });
                   });
  
   Thanks,
  
   Rick




[jQuery] Re: How can I generalize this code for all values?

2008-12-22 Thread Josh Nathanson

Rick - one shortcut you can do in your selector is:

$('input:text').each(function...

That might get you a better response from the DOM.  I think the problem you
are seeing might be because of your single quotes around text:
$('input[type=text]') not $(inp...@type='text']).

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Monday, December 22, 2008 10:10 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How can I generalize this code for all values?


Don't know if that's the best phrasing for the subject,
but what I'm trying to do is develop some code that
will work for all for inputs of type 'text', instead
of hard-coding the id values.

The original code is this:

$('input#street_number').blur(function() {

 if (this.value.length == 0)
 { $('#street-number-required-error').fadeIn(500);
   $('#submit').attr('disabled', 'disabled') }
 if (this.value.length  0)
 { $('#street-number-required-error').fadeOut(500);
   $('#submit').attr('disabled', '') };
});

$('input#street_name').blur(function() {

 if (this.value.length == 0)
 { $('#street-name-required-error').fadeIn(500);
   $('#submit').attr('disabled', 'disabled') }
 if (this.value.length  0)
 { $('#street-name-required-error').fadeOut(500);
   $('#submit').attr('disabled', '') };
});


Here's my coding attempt: (no errors in firebug, but not response
from the DOM)...

$(document).ready(function() {
 $(inp...@type='text']).each(function(i) {
  $(this).blur(function() {
   if (this.value.length == 0)
   { $(this.id.replace(/_/g, '-')+'-error').fadeIn(500);
 $('#submit').attr('disabled', 'disabled') }
   else
   { $(this.id.replace(/_/g, '-')+'-error').fadeOut(500);
 $('#submit').attr('disabled', '') }
  });
 });
});

Anyone care to offer guidance to get this working?

Thanks,

Rick



[jQuery] Re: Problems with more than one AJAX request at a time

2008-12-12 Thread Josh Nathanson

Yes, you should be able to fire the other requests.  Maybe you could post a
little code.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of hotdog...@gmail.com
Sent: Friday, December 12, 2008 10:48 AM
To: jQuery (English)
Subject: [jQuery] Problems with more than one AJAX request at a time


Hello there!

I'm sending an AJAX request using jQuery that could take a minute to
complete. However, I also want to send other smaller ajax requests to
the same host at the same time just after the first one starts. The
problem is, the smaller requests block until the first one finishes.
Is there a way to get around that? Shouldn't AJAX be asynchronous?



[jQuery] Re: Problems with more than one AJAX request at a time

2008-12-12 Thread Josh Nathanson

It looks like what you are doing there is called long polling, check this
out:

http://en.wikipedia.org/wiki/Comet_(programming)

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of hotdog...@gmail.com
Sent: Friday, December 12, 2008 3:18 PM
To: jQuery (English)
Subject: [jQuery] Re: Problems with more than one AJAX request at a time


On Dec 12, 1:02 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 Yes, you should be able to fire the other requests.  Maybe you could post
a
 little code.
Ah, thank you for your quick response! Here's the relevant part of my
code:
http://paste2.org/p/114906

This is in the head / section of my page. What I'm trying to do here
is implement a message system where people can send messages to each
other. Right now, it's at a proof-of-concept stage. I'll give you the
rundown of my code:

Firstly, jQuery's AJAX setup is called so the requests never cache in
the browser. Then, all the current messages are gotten and added to
the document with the call to $.getJSON(message). Then, I defined a
a waitformessages() function. In here, an AJAX request is sent to the
server (http://hostname/wait). This request is special because the
server doesn't send a response back until a new message appears and
there's something to send. Then, the cycle starts itself over with
another call to waitformessages().

Finally, I have a form and its submit handler is set up to post a new
message using AJAX to http://hostname/new?message=yadda .

Here's what's supposed to happen:
The user loads the page. All the messages are displayed and
waitformessages() has a persistent connection to the server just
waiting for somebody to say something. They type something in the
form, the request gets sent, and immediately the callback in
waitformessages() will fire, showing their message on the screen.

Problem is, according to firebug, the AJAX call to submit the new
message never gets sent because the call in waitformessages() hasn't
finished yet. D'oh.

If you'd like, I can post the server source code here too. It's
written in CherryPy.

Thanks a bunch and Merry Christmas!
-Mike



[jQuery] Re: IE Opacity Issue

2008-12-11 Thread Josh Nathanson

Maybe try removing the quotes around .9 - it is probably looking for a
number rather than a string.  I could see this borking IE.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Eric
Sent: Thursday, December 11, 2008 11:47 AM
To: jQuery (English)
Subject: [jQuery] IE Opacity Issue


Having a problem setting the overlay opacity in IE. The default works
fine, but as soon as I try to change it, all I get is the overlay
color at 100% opacity.

Here's my call:

$.blockUI({ message: $(.dialogPopup), css: { border: 'none',
textAlign: 'left' }, overlayCSS: { backgroundColor: '##fff', opacity:
'.9' } });

This works fine in FF2  3.

Any ideas?

Thanks,
Eric



[jQuery] Re: SOT: Blinking cursor in Firefox 2 bleeds through divs...

2008-12-04 Thread Josh Nathanson

There are some issues in FF with cursors and absolute positioned divs.
Might've been fixed in FF3.  Another one is the cursor won't show up in a
text field within an absolute positioned div that is in a layer above the
document body.  If you do a google search on firebox cursor bug or the
like you'll probably find some information.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ricardobeat
Sent: Thursday, December 04, 2008 1:13 PM
To: jQuery (English)
Subject: [jQuery] Re: SOT: Blinking cursor in Firefox 2 bleeds through
divs...


Can't reproduce it. Have you played with the z-indexes?

On Dec 4, 4:02 pm, Dan G. Switzer, II [EMAIL PROTECTED]
wrote:
 I have a weird problem I'm running into again, but haven't been able to
find
 a fix. In FF2, when I place a div / over an input / element that
 currently has focus, the blinking cursor shows up through the top layer.

 I put together this little video to show off the problem:

 http://blog.pengoworks.com/index.cfm/2008/12/4/Blinking-cursor-in-Fir...
 bleeds-through-divs

 Does anyone know of a fix for this problem?

 -Dan



[jQuery] Re: Josh Nathanson's magnify not showing stage in IE7

2008-12-03 Thread Josh Nathanson

Andrew - I got the link you sent and indeed, it does not seem to work on ie6
or ie7.  However, I couldn't see your code because it was compressed.  Have
you been able to get it working?

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrew
Sent: Monday, December 01, 2008 3:02 PM
To: jQuery (English)
Subject: [jQuery] Josh Nathanson's magnify not showing stage in IE7


I am almost certain that I previously had it working in IE7, which
leads me to think it's some new JS that is conflicting but I can't
figure it out. Where can I start to look for IE7 conflicts?



[jQuery] Re: Scope variables in anonymous functions?

2008-12-03 Thread Josh Nathanson

You have to do it that way because the context has changed.  Thus this in
the second anonymous function will refer to something different than in the
first.  A lot of people use the convention var self = this or something
similar.

Also within the anonymous function you can do this:
siblings.find( etc );
category.find( etc );

...since they are already jQuery objects.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of 703designs
Sent: Wednesday, December 03, 2008 9:44 AM
To: jQuery (English)
Subject: [jQuery] Scope variables in anonymous functions?


What I'm trying to figure out is how I can access parent scopes from a
nested anonymous function. As you can see here, I'm managing to do
this by assigning this to variables, but I know that there's a way
to pass this into the anonymous functions:

$(.responsibleCouncil .category).each(function() {
var category = $(this);
var input = $(this).find(.toggler input);
var siblings = $(this).siblings();

input.click(function() {
$(siblings).find(ul).hide();
$(category).find(ul).show();
});
});

Basically, those three assignments at the top of the first anonymous
function would be unnecessary if I knew of a better way to access
this from nested functions.



[jQuery] Re: Josh Nathanson's magnify not showing stage in IE7

2008-12-01 Thread Josh Nathanson

Andrew -- I just checked the demo page on IE7 and it seems to work fine.
Can you post your code or a test page somewhere I can look at?

-- Josh (plugin author)

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrew
Sent: Monday, December 01, 2008 3:02 PM
To: jQuery (English)
Subject: [jQuery] Josh Nathanson's magnify not showing stage in IE7


I am almost certain that I previously had it working in IE7, which
leads me to think it's some new JS that is conflicting but I can't
figure it out. Where can I start to look for IE7 conflicts?



[jQuery] Re: Lightbox overlay, fade out background

2008-11-13 Thread Josh Nathanson

No need to reinvent the wheel, I'd use the BlockUI plugin in conjunction
with whatever you're working on.

-- Josh



-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of coughlinsmyalias
Sent: Thursday, November 13, 2008 5:15 PM
To: jQuery (English)
Subject: [jQuery] Lightbox overlay, fade out background


Hey guys, I have been looking at some code of lighboxes and am trying
to fade out the background like you see when you look at lightbox
scripts. I am trying to get some code from other plugins but it is
kind of a mess.

Do anyone of you know how to fade out the background add an overlay
with an opacity, to cover the entire page?

Thanks,

Ryan



[jQuery] Re: Advice on sIEve/Drip?

2008-11-05 Thread Josh Nathanson


An important aspect of this is to focus on what happens when you reload the 
page or navigate away.  If the memory drops back down to its original state, 
you have helped the end user by not leaving them a legacy of used memory. 
It's much more difficult to try and keep memory from climbing in the first 
place.  If you can make it so the memory is reclaimed when you unload the 
page, you have gone a long way in helping the user.


-- Josh



- Original Message - 
From: trixta [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, November 05, 2008 6:14 AM
Subject: [jQuery] Re: Advice on sIEve/Drip?





On Nov 4, 12:20 am, Jeffrey Kretz [EMAIL PROTECTED] wrote:

OUCH.

With over 25,000 lines of javascript code (full featured CMS) that's a
nightmare to track down.

Am I out of luck? Are there no other alternative tools like sIEve that are
still in development?



Hi,

there is another tool by microsoft, you can try:
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx

but this tool doesn´t find all memory leaks.

this jquery-related info could be helpfull, too:
http://groups.google.com/group/jquery-dev/browse_thread/thread/4a99f6e9b2e33057/30099a04db7f87b9
http://www.outsidethediv.com/2008/10/removechild-vs-the-garbage-bin/

One last advice. You don´t have to fix all memory leaks in IE6. It
really depends on the cost-benefit-ratio (hard effort/work to fix it
vs. noticeable advancement for the enduser).

regards
alex 



[jQuery] Re: Getting width of broken image updated: working now

2008-10-30 Thread Josh Nathanson


Hey, that's pretty cool Andy.  Interesting way to view comics.  Glad my 
little bit of code was able to help.


-- Josh

- Original Message - 
From: Andy Matthews [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, October 30, 2008 8:09 AM
Subject: [jQuery] Re: Getting width of broken image updated: working now




Josh...

Since you may be curious what I was working on, it's just a little comic
strip viewer for a webcomic called Goats:

http://www.commadelimited.com/code/goats.cfm

It's archives go back roughly 10 years, and I'm trying to work through all
the backlog. Since it's published daily, the archives are approaching 3000
strips. Anywya, I wanted a way to quickly read through back strips, and so 
I

wrote this little viewer.



andy

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh Nathanson
Sent: Wednesday, October 29, 2008 2:44 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Getting width of broken image?


Another thing you can try is attach the handler directly to the load event
for each image:

$(img).load(function() {
   alert('image ' + this.src + ' is loaded and has width ' +
$(this).width()); });

This should work ok within document.ready, as the img tags will be loaded 
in

the DOM and have the event handler bound before the images themselves are
loaded.

-- Josh

- Original Message -
From: Andy Matthews [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 29, 2008 11:37 AM
Subject: [jQuery] Re: Getting width of broken image?



Hrm...

That worked, but it's taking longer than I'd like, and it's not
really consistent. I'll just go another route. Thanks for the input
guys.

On Oct 29, 11:44 am, Josh Nathanson [EMAIL PROTECTED] wrote:

Andy - window.onload is called only after all images are loaded, so you
can
do this:

$(window).load(function() {
$(img).each(function() {
alert( this.offsetWidth500 );
});

});

-- Josh

- Original Message -
From: Andy Matthews [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 29, 2008 9:24 AM
Subject: [jQuery] Re: Getting width of broken image?

Okay...

I figured out why it's not working. My code is firing before the
images are fully loaded, therefore the width of the image is zero
until the browser downloads the image.

I installed a click event on each image which reported the actual
width correctly.

So, how might I only run this code AFTER the images have loaded?

$('img').each(function(){
alert(this.offsetWidth500);
});

Alternately, is there a way to test to see if the image is broken
using jQuery?

On Oct 29, 10:54 am, ricardobeat [EMAIL PROTECTED] wrote:
 Besides the bracket weidc mentioned, is your document valid?

 I get the correct image width by using width() on both IE and FF.
 Alternatively you can check for the offsetWidth attribute.

 $('img').each(function(){
 alert(this.offsetWidth500);

 });

 On Oct 29, 11:30 am, Andy Matthews [EMAIL PROTECTED]
 wrote:

  I'm loading in a batch of images dynamically. Some of the images 
  might

  not
  exist and I'm wondering how I might test for that image using jQuery
  (1.2.6). All I really want to do is to remove that img from the DOM 
  so

  that
  it doesn't show on the page.

  I thought at first it would be simple enough to test the width of the
  image.
  All the valid images should be around 600 pixels wide, whereas the
  broken
  image should be 30 or so.

  I tried this:

  ${'img').each(function(){
  alert( $(this).width() );

  });

  But I got 0 for both a valid, and invalid, image. Anyone have any
  ideas?

  andy







[jQuery] Re: Cornerz 0.5

2008-10-30 Thread Josh Nathanson


Looks good, I'm always on the lookout for curved corners plugins.

-- Josh


- Original Message - 
From: weepy [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, October 30, 2008 6:07 AM
Subject: [jQuery] Cornerz 0.5




I released Cornerz v0.5 today.

http://labs.parkerfox.co.uk/cornerz/

Features :

# Antialiased
# Very Fast
# Support for any size radius and border width with minimal
performance increase
# No excanvas
# Current layout is maintained
# Supports fluid layouts.
# Original div still shows through, so can easily do hover effects
# Script is only 4.0k uncompressed
# Tested on :
   * IE6 XP/Vista
   * IE7 XP/Vista
   * Firefox 2 Ubuntu/Windows
   * Safari 3 Windows/Mac
   * Opera 9 Windows/Linux
   * Chrome, iPhone


Version 0.5 provides a fix for IE, where IE has trouble with odd
valued dimensions. The script will now adjust these automatically.

http://labs.parkerfox.co.uk/cornerz/


[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Josh Nathanson


Andy - window.onload is called only after all images are loaded, so you can 
do this:


$(window).load(function() {
   $(img).each(function() {
   alert( this.offsetWidth500 );
   });
});

-- Josh

- Original Message - 
From: Andy Matthews [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 29, 2008 9:24 AM
Subject: [jQuery] Re: Getting width of broken image?



Okay...

I figured out why it's not working. My code is firing before the
images are fully loaded, therefore the width of the image is zero
until the browser downloads the image.

I installed a click event on each image which reported the actual
width correctly.

So, how might I only run this code AFTER the images have loaded?

$('img').each(function(){
  alert(this.offsetWidth500);
});

Alternately, is there a way to test to see if the image is broken
using jQuery?


On Oct 29, 10:54 am, ricardobeat [EMAIL PROTECTED] wrote:

Besides the bracket weidc mentioned, is your document valid?

I get the correct image width by using width() on both IE and FF.
Alternatively you can check for the offsetWidth attribute.

$('img').each(function(){
alert(this.offsetWidth500);

});

On Oct 29, 11:30 am, Andy Matthews [EMAIL PROTECTED]
wrote:

 I'm loading in a batch of images dynamically. Some of the images might 
 not

 exist and I'm wondering how I might test for that image using jQuery
 (1.2.6). All I really want to do is to remove that img from the DOM so 
 that

 it doesn't show on the page.

 I thought at first it would be simple enough to test the width of the 
 image.
 All the valid images should be around 600 pixels wide, whereas the 
 broken

 image should be 30 or so.

 I tried this:

 ${'img').each(function(){
 alert( $(this).width() );

 });

 But I got 0 for both a valid, and invalid, image. Anyone have any ideas?

 andy 




[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Josh Nathanson


Another thing you can try is attach the handler directly to the load event 
for each image:


$(img).load(function() {
   alert('image ' + this.src + ' is loaded and has width ' + 
$(this).width());

});

This should work ok within document.ready, as the img tags will be loaded in 
the DOM and have the event handler bound before the images themselves are 
loaded.


-- Josh

- Original Message - 
From: Andy Matthews [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 29, 2008 11:37 AM
Subject: [jQuery] Re: Getting width of broken image?



Hrm...

That worked, but it's taking longer than I'd like, and it's not
really consistent. I'll just go another route. Thanks for the input
guys.

On Oct 29, 11:44 am, Josh Nathanson [EMAIL PROTECTED] wrote:
Andy - window.onload is called only after all images are loaded, so you 
can

do this:

$(window).load(function() {
$(img).each(function() {
alert( this.offsetWidth500 );
});

});

-- Josh

- Original Message -
From: Andy Matthews [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 29, 2008 9:24 AM
Subject: [jQuery] Re: Getting width of broken image?

Okay...

I figured out why it's not working. My code is firing before the
images are fully loaded, therefore the width of the image is zero
until the browser downloads the image.

I installed a click event on each image which reported the actual
width correctly.

So, how might I only run this code AFTER the images have loaded?

$('img').each(function(){
alert(this.offsetWidth500);
});

Alternately, is there a way to test to see if the image is broken
using jQuery?

On Oct 29, 10:54 am, ricardobeat [EMAIL PROTECTED] wrote:
 Besides the bracket weidc mentioned, is your document valid?

 I get the correct image width by using width() on both IE and FF.
 Alternatively you can check for the offsetWidth attribute.

 $('img').each(function(){
 alert(this.offsetWidth500);

 });

 On Oct 29, 11:30 am, Andy Matthews [EMAIL PROTECTED]
 wrote:

  I'm loading in a batch of images dynamically. Some of the images might
  not
  exist and I'm wondering how I might test for that image using jQuery
  (1.2.6). All I really want to do is to remove that img from the DOM so
  that
  it doesn't show on the page.

  I thought at first it would be simple enough to test the width of the
  image.
  All the valid images should be around 600 pixels wide, whereas the
  broken
  image should be 30 or so.

  I tried this:

  ${'img').each(function(){
  alert( $(this).width() );

  });

  But I got 0 for both a valid, and invalid, image. Anyone have any 
  ideas?


  andy 




[jQuery] Re: Problem with adding EventListener

2008-10-28 Thread Josh Nathanson


jQuery makes it simpler:

$(#msg_button).bind(click, show_msg);

Or, if you are not reusing the function:

$(#msg_button).click( function() {
   alert('Nice to show you this');
});

-- Josh


- Original Message - 
From: Jquery-Newbe [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Tuesday, October 28, 2008 8:07 AM
Subject: [jQuery] Problem with adding EventListener




Hi, I have just started using JQuery. And so far, I have gotten some
problems with adding  events in the loading stage to a button.

The following is my code

head
script src='js/jquery.min.js'/script
script type='text/javascript'
$(function(){
$(#msg_button)[0].addEventListener('click',show_msg,false)
});

function show_msg()
{
alert(Nice to show you this)
}
/script
/head

body
div id='msg'/div
button id='msg_button' name='msg_button' Show Message/button
/body


So Here are my problems

Problem 1
$(#msg_button)[0].addEventListener('click',show_msg,false) doesn't
work in IE. It give me an error message saying that This object
doesn't support the property or method . I think I know the reason
for this. But I thought addEventListener method should be cross
platform in Jquery.

Problem 2
When I change $(#msg_button)[0] to $(#msg_button) instead, and it
gives me an error in both IE and Firefox saying $
(#msg_button).addEventListener is not a function. After a deeper
inspection,   I found out that $(#msg_button) only returns an Object
object , where $(#msg_button)[0] returns object HTMLButtonElement
which is identical to what  document.getElementById returns. Should $
(#msg_button) return a proper object like Button, Link and so on
instead of a general Object? And also I am not sure if Javacript
support dereferencing as Java does.

So I come up a solution :

I put

function addEvent(obj,type,fn) {
if (obj.addEventListener) //in Mozila
{
obj.addEventListener(type,fn,false);
return true;
}
else // in IE
{
obj.attachEvent(on+type,fn)
}
}

in my javascript block.

and replace $(#msg_button).addEventListener('click',show_msg,false)
with addEvent($(#msg_button)[0],'click',show_msg). And everything
work fine.


But my concern is this I though I can do all these common things in
Jquery way without introducing any of my self-defined functions!!!

Please Open my eyes to Jquery World.

Thank you very much.












[jQuery] Re: Selecting an element whose ID is in a variable

2008-10-27 Thread Josh Nathanson


You want this:

$(# + fieldset_id);

Don't feel bad, that trips up a lot of people at first (myself included).

Basically the selector is just a string, so you can use the usual JS string 
methods to get what you need.


-- Josh


- Original Message - 
From: fredriley [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Monday, October 27, 2008 1:13 PM
Subject: [jQuery] Selecting an element whose ID is in a variable




This has got to be a FAQ, but I can't see it in the FAQ so here goes,
and apologies if it's a stupid question but I'm a relative newbie to
jQuery:

How can I select an element whose id is stored in a constructed string
variable?

What I mean is something like the following. In a document I've got
span elements with IDs 1, 2, 3, etc, and these correspond to
fieldset elements with IDs part1, part2, part3, etc. The user
clicks on a span, the code gets its ID, constructs the ID of the
corresponding fieldset, then does something with that (hides it). So
something like:

$(span).click(function()
{
  // get the handle of the clicked element
var mySpan = $(this);
 // get its id
var span_id = mySpan.attr(id);
// construct the fieldset id
var fieldset_id = part + span_id;
   // select the fieldset then hide it - now I'm stuck
});

I've tried the selectors:

alert($(fieldset_id).attr(id)); // gives 'undefined'
alert($(#fieldset_id).attr(id)); // syntax error: illegal character,
not surprisingly
alert($(#fieldset_id).attr(id)); // gives 'undefined'

An alternative would be to get the handle of the fieldset element,
which could be achieved with the Javascript:

var id2 = document.getElementById(fieldset_id);
alert(id2.id); // gives the id of the fieldset

but I don't know how to do this in jQuery. I'd prefer to go the whole
jQuery hog and not mix it with raw JS, and I could do with
understanding how to do this simple operation anyway to improve my
jQuery understanding, so tips would be welcome. TIA.

What I'm trying to do is generalise the specific code in the test at
http://www.nottingham.ac.uk/~ntzfr/test/ajax/jquery/show_hide.html to
handle a form with any number of toggle-able sections.

Cheers

Fred






[jQuery] Re: BlockUI: oversized overlay bug in IE web browsers ( demo included )

2008-10-22 Thread Josh Nathanson



Thanks a bunch, Mike. Hopefully, blockUI's author will discover this
fix eventually.


It shouldn't take long, Mike *is* the author.

-- Josh



[jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included )

2008-10-21 Thread Josh Nathanson


You might want to give jqModal a shot.  BlockUI is better for blocking 
specific parts of a document, during an ajax call or the like.  jqModal is 
more of a modal window solution that might be better suited to what you're 
trying to do.  There's also SimpleModal which I personally haven't used.


-- Josh

- Original Message - 
From: tallvanilla [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Tuesday, October 21, 2008 10:04 AM
Subject: [jQuery] Re: BUG: oversized overlay in IE web browsers ( demo 
included )





(bump)

Any takers?


On Oct 20, 7:47 pm, tallvanilla [EMAIL PROTECTED] wrote:

Thanks for the reply, Josh... but that isn't the problem. To
demonstrate, I updated my demo according to your suggestion:

http://74.205.76.81/blockuitest/

Even if that WAS the solution, it would force people to zero out their
body padding and margins. Not a problem for most, but inconvenient for
many. If you consider IE important, it's a blockUI bug.

Any other takers? Here's how Boxy's author fixed it (in his own
words):

I've added a separate sizing method specifically for IE6 which uses
the viewport dimensions instead of the document, and repositions on
scroll as well as on resize. I tried using this approach for all
browsers but Firefox was having none of it.

JR

On Oct 20, 4:09 pm, Josh Nathanson [EMAIL PROTECTED] wrote:

 This happens where there is some padding or margin on the body.  If you 
 set

 them to 0 via css it should take care of the problem.

 /* css */
 body {
 padding: 0;
 margin: 0;

 }

 -- Josh

 - Original Message -
 From: tallvanilla [EMAIL PROTECTED]
 To: jQuery (English) jquery-en@googlegroups.com
 Sent: Monday, October 20, 2008 2:27 PM
 Subject: [jQuery] BUG: oversized overlay in IE web browsers ( demo

 included )

  Hello. I found a minor bug that affects overlay in IE web browsers 
  (at

  least in IE6).

  Please take a look at this very simple demo:

 http://74.205.76.81/blockuitest/

  In IE(6), the overlay is a bit taller than the browser window, so a
  scrollbar appears on the right whenever the overlay is present. In
  other web browsers, this doesn't happen.

  I found a similar bug with the Boxy plug-in a couple of weeks ago, 
  and

  its author was able to fix it pretty easily. I'm a jQuery/javascript
  novice, so I'm not sure how the fix was implemented. Would this be
  worthwhile and easy fix for blockUI as well?

  JR 




[jQuery] Re: how to detect current toggle setting?

2008-10-16 Thread Josh Nathanson


If you already have a jQuery object you can do this:

jqObj.is(:visible); // returns boolean

-- Josh


- Original Message - 
From: Jay [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, October 16, 2008 2:43 PM
Subject: [jQuery] Re: how to detect current toggle setting?



On Oct 16, 3:53 pm, ricardobeat [EMAIL PROTECTED] wrote:

Read the docs, read the docs.

http://docs.jquery.com/Selectors


I did. I use them frequently.
There's no mention of those two functions on the selectors page In
docs.jquery.com or the downloadable version.
There's no detail on how they actually work on the effects page
either.



$('#element:visible') or $('#element:hidden')


Tried it and it didn't work for me. This also requires javascript
search the dom to find '#element'.
Not terribly efficient if I already have a reference to the object in
question. Wouldn't
obj.attr('some_property_I_dont_know_about')
or
obj.get(0).some_property_I_dont_know_about
be much faster?


[jQuery] Re: Proper jQuery object creation for chaining

2008-10-15 Thread Josh Nathanson


Hey Sliver,

It looks like you are expecting jQuery to work like Prototype does...I'm not 
too familiar with Prototype, but my understanding is that it has functions 
which assist with the inheritance issues in Javascript.


jQuery is more about easily selecting DOM elements and doing stuff with them 
(find stuff, do stuff) and not as much about OOP and inheritance.


You're a bit on the wrong track using the $.fn namespace to define your 
classes -- that namespace allows for plugin methods, which can then be run 
in the context of a jQuery object and its collection of DOM nodes.  So you 
might do something like this:


$.fn.invert= function() {
   return this.each(function() {
this.style.backgroundColor = '#00';
this.style.color = '#ff';
   });
};

Then you could do this:
$(div).invert(); // invert all divs on page

Your best bet might be to leverage both libraries - Prototype for the 
OOP/inheritance that you're used to, and jQuery for the DOM 
manipulation/plugin architecture.


Hope that helps a bit.

-- Josh




- Original Message - 
From: sliver [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 15, 2008 9:02 AM
Subject: [jQuery] Proper jQuery object creation for chaining




Sorry in advance if this is confusing...

I am new to jQuery (converting myself from Prototype), and as such I
am finding situations where I need to create a new object, which I
would have done with a class in Prototype (as such, doesn't make sense
for it to appear anywhere except the start of a chain, since it will
return a new object). This object will also be used similar to a
superclass for other objects as well. I also want the object to be
chain-able as well.

My first attempt at this was something along these lines:

(function($) {
function create($opts) {
// some code to create an object
return obj;
}

$.fn.firstObj = function($opts) {
// Error any chained calls
if (this.length) throw SyntaxError();

return create($.extend({}, arguments.callee, $opts));
}

$.extend(
$.fn.firstObj,
{
// Some public methods and default properties
prop1: 'val1',
prop2, 'val2',
method1: function() { dosomething(arguments); }
}
);
})(jQuery);


(function($) {
function create($opts) {
// some code to create an object
return obj;
}

$.fn.secondObj = function($opts) {
// Error any chained calls
if (this.length) throw SyntaxError();

return $.fn.firstObj($.extend({}, arguments.callee, $opts));
}

$.extend(
$.fn.secondObj,
{
// Some public methods and default properties
prop1: 'newval1', //overrides $.fn.firstObj.prop1
newprop2, 'val2',
newmethod1: function() { dosomethingelse(arguments); }
}
);
})(jQuery);

Problem is, that say I chain either of the returned objects, I lose
the public methods for those objects.

example:

var newObj = $.fn.firstObj({prop1: 'foobar'});
console.log(newObj.method1 + ''); // logs: function()
{dosomething(arguments);}
newObj.click( function() { console.log(this.method1 + ''); } ); //
logs undefined now (I've also tried $(this).method1)

What is the proper way of creating a new object in jQuery so that it
can properly be chained afterwards? 




[jQuery] Re: .next() -- huh?

2008-10-15 Thread Josh Nathanson



$(#nav div).hover(function(){alert($
(this).next('span').text());},function(){});


try this:

alert($(span:first, this).text());

The span you want is actually a child of the div, while next('span') looks 
for a sibling span.


-- Josh


- Original Message - 
From: bnlps [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 15, 2008 2:17 PM
Subject: [jQuery] .next() -- huh?




hi,

should be simple to say what's wrong ... well -


alert() works, but alerts nothing / empty ... something like 'MOO!' or
'BETA!' would
be great -- what's wrong with code?


--

$(#nav div).hover(function(){alert($
(this).next('span').text());},function(){});

--


div id=nav

div
 spanMOO!/span
 ul lifoo/li libar/li /ul
/div

div
 spanBETA!/span
 ul lihello /li liworld/li /ul
/div

...

/div 




[jQuery] Re: JQuery Selector and Java Script Variable

2008-10-13 Thread Josh Nathanson


That looks like the proper syntax to get your desired selector.  Are you 
getting an error or unexpected results?


-- Josh

- Original Message - 
From: Shadi Almosri [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Monday, October 13, 2008 9:32 AM
Subject: [jQuery] JQuery Selector and Java Script Variable




Hiya,

I've not been able to find an answer to this online! can someone point
out the correct syntax for this:

var myRel = $(this).attr(rel);
var largePath = $('a[rel*=' + myRel +']').attr(href);

Basicly the myRel gets set correctly, but how do i use the javascript
variable as part of the jquery selector so that i can get a selector
that looks like:

(assuming myRel was 5)...

var largePath = $('a[rel*=5]').attr(href);

Thanks in advance!

Shadi 




[jQuery] Re: How do I remove a plugin melodramatically

2008-10-10 Thread Josh Nathanson


I think when you unbind it, you should put the back of your hand to your 
forehead and say, Oh woe is me!


Sorry, it's Friday.


- Original Message - 
From: me-and-jQuery [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, October 10, 2008 2:23 PM
Subject: [jQuery] Re: How do I remove a plugin melodramatically




One option is to use unbind on the event that this plugin uses. $.
(element).unbind(click);

Anyone has any other solution?

On Oct 10, 9:21 pm, Dan M [EMAIL PROTECTED] wrote:

All,

If I were to add a plugin to an element on a page, say clueTip. How
could I remove the plugin from the element when I want without
reloading the page?

Regards,
Dan 




[jQuery] Re: An Interesting Twist on a Pastebin

2008-10-09 Thread Josh Nathanson
Yeah, what a great idea and incredible job by Remy.

-- Josh

  - Original Message - 
  From: pixeline 
  To: Jquery-en 
  Sent: Thursday, October 09, 2008 11:57 AM
  Subject: [jQuery] An Interesting Twist on a Pastebin


  guys, we should definitely use this online tool to ask questions. it seems 
really useful to our mailinglist !




  Sent to you by pixeline via Google Reader:


  An Interesting Twist on a Pastebin
  via Ajaxian » Front Page by Rey Bango on 10/9/08


  Pastebins have become an important part of sharing code with colleagues. 
Sites such as Pastebin  Pastie.org are extremely popular because they’re easy 
to use and very effective in letting people compare notes on source code, 
especially in a support setting. 

  Remy Sharp wanted to take the pastebin concept a step further, past the 
static posting of code. His idea, which he tossed around for 6 months, finally 
came to fruition in the form of JS Bin, a new pastebin site with a twist:

JS Bin is a form of paste bin, but with a twist. It allows you to also 
include the HTML and CSS to provide context to your pasty. As such, it means 
you can actually run the JavaScript and pass this on to a colleague to help to 
debug.

  This is a great idea as it lets you troubleshoot your code while seeing 
immediate results. The feature list is well thought out as well.

a.. Save private snippet 
b.. Remote Ajax debugging 
c.. Snippet URLs run entirely on their own (i.e. without the JS Bin 
framework around them) 
d.. Support to quickly inject major JS libraries including jQuery, jQuery 
UI, Prototype, Scriptaculous, Dojo, MooTools  YUI 
e.. Saves state within the open window (i.e. refresh and the code doesn’t 
reset) 
  The ability to inject many of the popular JavaScript libraries is especially 
important and I would highly recommend individual project teams to contact Remy 
directly to have their libs included.

  To give this a run, I’d suggest going to the JS Bin site and putting it 
through its paces. In addition, Remy has produced two videos which go into 
detail on how to leverage JS Bin:

a.. JS Bin Video Introduction 
b.. Ajax Debugging 
 



  Things you can do from here:
a.. Subscribe to Ajaxian » Front Page using Google Reader 
b.. Get started using Google Reader to easily keep up with all your 
favorite sites



[jQuery] Re: AJAX Success Callback referring to $(this)

2008-10-08 Thread Josh Nathanson


this referenced in the success callback will refer to the jQuery object 
when you do an ajax call.


You might want to put the ajax call within another function that can also 
receive information about the triggering element:


doAjax: function( trigger ) {
   jQuery.ajax({
   // etc.
   success: function() {
   if ( trigger condition ) {
   // do stuff
   }
   }
   });
}

$(triggeringelement).click(function() {
   doAjax( this );
});

-- Josh


- Original Message - 
From: Wayne [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 08, 2008 7:49 AM
Subject: [jQuery] AJAX Success Callback referring to $(this)




I've been looking for this quite a bit, today, and haven't quite found
what I'm looking for, so maybe someone can point me in the right
direction.

I'm performing an AJAX request, and I pass an anonymous function as
the success callback, upon which I will want to do some DOM
modification to the element that triggered the AJAX event. Ordinarily,
$(this) would work fine for doing this, but it seems that $(this)
points instead to something besides a DOM element.

First, what does $(this) point to when you're inside the AJAX Success
callback.

Second, what is considered the best practice for accessing the
triggering element after a successful AJAX query?

Any help is appreciated,
Wayne 




[jQuery] Re: AJAX Success Callback referring to $(this)

2008-10-08 Thread Josh Nathanson


Ok, I think I see what's happening -- you have something like this:

$(whatever).click(function() {
   $.ajax({ blah blah..

So you just need to do this:

$(whatever).click(function() {
   var trigger = this;
   $.ajax({ 
   success: function() {

   // do whatever with 'trigger'
   }
   });
});

-- Josh



- Original Message - 
From: Wayne [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 08, 2008 12:15 PM
Subject: [jQuery] Re: AJAX Success Callback referring to $(this)



OK. I haven't tried this yet, but how is this any different? Even
though you're moving the ajax call inside of another function, aren't
you abstracting the same logic out by calling the anonymous function
inside of success? Maybe I'm not understanding what trigger and
trigger condition are supposed to represent, but I assumed that was
related to my isNaN(r) logic.

Thanks,
-Wayne

On Oct 8, 12:36 pm, Josh Nathanson [EMAIL PROTECTED] wrote:

this referenced in the success callback will refer to the jQuery object
when you do an ajax call.

You might want to put the ajax call within another function that can also
receive information about the triggering element:

doAjax: function( trigger ) {
jQuery.ajax({
// etc.
success: function() {
if ( trigger condition ) {
// do stuff
}
}
});

}

$(triggeringelement).click(function() {
doAjax( this );

});

-- Josh

- Original Message -
From: Wayne [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 08, 2008 7:49 AM
Subject: [jQuery] AJAX Success Callback referring to $(this)

 I've been looking for this quite a bit, today, and haven't quite found
 what I'm looking for, so maybe someone can point me in the right
 direction.

 I'm performing an AJAX request, and I pass an anonymous function as
 the success callback, upon which I will want to do some DOM
 modification to the element that triggered the AJAX event. Ordinarily,
 $(this) would work fine for doing this, but it seems that $(this)
 points instead to something besides a DOM element.

 First, what does $(this) point to when you're inside the AJAX Success
 callback.

 Second, what is considered the best practice for accessing the
 triggering element after a successful AJAX query?

 Any help is appreciated,
 Wayne




[jQuery] Re: AJAX Success Callback referring to $(this)

2008-10-08 Thread Josh Nathanson


I guess I'm not understanding what you're trying to do.  The code I provided 
is the standard way of referencing this when you want to reference the 
original context in an inner function.


-- Josh

- Original Message - 
From: Wayne [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 08, 2008 2:18 PM
Subject: [jQuery] Re: AJAX Success Callback referring to $(this)



Right, but that trigger doesn't work in the context of the anonymous
function. Unless, I'm missing something you changed.

-Wayne

On Oct 8, 3:43 pm, Josh Nathanson [EMAIL PROTECTED] wrote:

Ok, I think I see what's happening -- you have something like this:

$(whatever).click(function() {
$.ajax({ blah blah..

So you just need to do this:

$(whatever).click(function() {
var trigger = this;
$.ajax({
success: function() {
// do whatever with 'trigger'
}
});

});

-- Josh

- Original Message -
From: Wayne [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 08, 2008 12:15 PM
Subject: [jQuery] Re: AJAX Success Callback referring to $(this)

OK. I haven't tried this yet, but how is this any different? Even
though you're moving the ajax call inside of another function, aren't
you abstracting the same logic out by calling the anonymous function
inside of success? Maybe I'm not understanding what trigger and
trigger condition are supposed to represent, but I assumed that was
related to my isNaN(r) logic.

Thanks,
-Wayne

On Oct 8, 12:36 pm, Josh Nathanson [EMAIL PROTECTED] wrote:
 this referenced in the success callback will refer to the jQuery 
 object

 when you do an ajax call.

 You might want to put the ajax call within another function that can 
 also

 receive information about the triggering element:

 doAjax: function( trigger ) {
 jQuery.ajax({
 // etc.
 success: function() {
 if ( trigger condition ) {
 // do stuff
 }
 }
 });

 }

 $(triggeringelement).click(function() {
 doAjax( this );

 });

 -- Josh

 - Original Message -
 From: Wayne [EMAIL PROTECTED]
 To: jQuery (English) jquery-en@googlegroups.com
 Sent: Wednesday, October 08, 2008 7:49 AM
 Subject: [jQuery] AJAX Success Callback referring to $(this)

  I've been looking for this quite a bit, today, and haven't quite found
  what I'm looking for, so maybe someone can point me in the right
  direction.

  I'm performing an AJAX request, and I pass an anonymous function as
  the success callback, upon which I will want to do some DOM
  modification to the element that triggered the AJAX event. Ordinarily,
  $(this) would work fine for doing this, but it seems that $(this)
  points instead to something besides a DOM element.

  First, what does $(this) point to when you're inside the AJAX Success
  callback.

  Second, what is considered the best practice for accessing the
  triggering element after a successful AJAX query?

  Any help is appreciated,
  Wayne






[jQuery] Re: ANNOUNCE: jQuery listnav plugin

2008-10-02 Thread Josh Nathanson
Yeah, really nicely done...I'll definitely use that if I ever have need for it.

-- Josh

  - Original Message - 
  From: Jack Killpatrick 
  To: jquery-en@googlegroups.com 
  Sent: Thursday, October 02, 2008 12:52 PM
  Subject: [jQuery] ANNOUNCE: jQuery listnav plugin


  Hi All,

  Today we released our first jQuery plugin, which provides an easy way to add 
alphabet-based navigation to any UL or OL list. Here's a link to our 
announcement blog entry:

  http://blogs.ihwy.com/dev/post/jQuery-listnav-plugin-version-10-released.aspx

  And below is the info from the blog entry to save you the click. Thanks to 
Mike Alsup for his docs about creating jquery plugins, and a shout out to Liam 
Byrne, who helped me (via this list) a few months ago with some jQuery for 
isolating text inside of list items.

  - Jack

  
  blogged

  Today we're releasing a jQuery plugin that we created for the business 
directory section of a pet project site of ours, 
http://www.hwy9.com/Directory/boulder-creek.aspx. We'd always wanted to have a 
javascript-based control that we could easily apply to long lists of items to 
allow quickly navigating around the list. Since most lists are alphabetically 
sorted, we came up with a plugin that allowed us to have a long list and then, 
by binding the list to our jQuery listnav plugin, an alphabet-based navigation 
bar would magically appear above the list, showing all of the letters from A to 
Z. Clicking on a letter dynamically filters the list, so you can, for example, 
click on C and the list changes on-the-fly to show you only items beginning 
with C. 
  There are lots of neat little features to the control. We've posted full 
information and demos here:


  http://www.ihwy.com/labs/jquery-listnav-plugin.aspx . 

  A couple of the interesting features worth calling out are 1) that when you 
hover over a letter in the list navigation bar, a count appears above the 
letter, telling you how many items will appear if you click that letter 2) 
letters that don't have any items under them appear looking disabled, as a 
visual clue that there aren't any items starting with that letter (so that the 
user doesn't have to find out by clicking the letter). 

  One of the demos (demo 4) also shows using the listnav plugin on a list that 
has floated items in it. In the demo, each list item looks like a box and they 
are arranged left-to-right, row by row. Clicking on a letter shows only the 
boxes that have wording that starts with that letter. This could be handy for 
making an address-book like layout on a web site: click the letter in the 
navigation to see the contacts that start with Y, for example. Each box can 
contain anything you want it to: the listnav control pays attention only to the 
first letter of the first text in the list item. 

  The control has been optimized for speed. It's able to handle binding to 
lists with hundreds of items in them very quickly. Any jQuery selector can be 
used to bind to your lists, so you can bind it to multiple lists on a single 
page using just a CSS class name, if you want to. It works with UL and OL 
(numbered) lists. If you use an OL, the numbers restart themselves for each set 
of list items that appear (ie, if you click on 'C' and that has 5 items, they 
will appear numbered from 1-5). 

  We hope you enjoy the jQuery listnav plugin. We enjoyed creating it. 





[jQuery] Re: NEW PLUGIN (beta): ContextMenu

2008-10-02 Thread Josh Nathanson


WOW Matt, that looks dynamite.

Some cool new plugins coming out! 


-- Josh


- Original Message - 
From: Matt Kruse [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, October 02, 2008 3:50 PM
Subject: [jQuery] NEW PLUGIN (beta): ContextMenu




I've been working on a new Context Menu plugin. I know some exist, and
I've used them, but I've always wanted something better. Here is mine:

http://www.javascripttoolbox.com/lib/contextmenu/

This is at a pre-beta stage right now. Not ready to be used, but I
would love to hear what people think. I still need to finish the
examples, write some more documentation, and package it up a little
better. I expect to have it at Version 1.0 in a few days.

Hopefully the examples on that page will show you what it can do and
you can see the source to critique it.

I wrote this primary for my own use, but I think that a lot of people
might find it useful.

I welcome any feedback! Thanks!

Matt Kruse


[jQuery] Re: form select...

2008-10-01 Thread Josh Nathanson


Did you try my code?  It should do what you describe.

-- Josh


- Original Message - 
From: GARIL [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 01, 2008 1:12 PM
Subject: [jQuery] Re: form select...




Thank your for your answers but I don't want to set the value.
What I want to happen is to programmatically change the select into:

BEFORE AFTER
form   form
Select your favorite fruit:  Select your favorite fruit:
select id=fruits select id=fruits
 optionApple/optionoptionApple/option
 optionOrange/option  optionOrange/option
 optionPineapple/option  option SELECTEDPineapple/option
--
 optionBanana/option optionBanana/option
/select  /select
/form/form


On Oct 1, 2:50 pm, greenteam003 [EMAIL PROTECTED] wrote:

You could achieve this by using $('#fruits').val('Banana').



[jQuery] Re: form select...

2008-10-01 Thread Josh Nathanson


Give this a go:

$(option,#fruits).each(function() {
   $(this).attr(selected, $(this).text() == 'Pineapple' );
});

-- Josh

- Original Message - 
From: GARIL [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, October 01, 2008 12:38 PM
Subject: [jQuery] Re: form select...




form
Select your favorite fruit:
select id=fruits
 optionApple/option
 optionOrange/option
 optionPineapple/option
 optionBanana/option
/select
/form

In the form above how do I programmatically set using jQuery the
Pineapple option as the selected default?



[jQuery] Re: Simple question about Radio Buttons

2008-09-19 Thread Josh Nathanson


You could use either this.checked or $(this).attr(checked).

this refers to the dom node, so if you want to use the attr method on 
this you have to jQuery-ize it.


this.checked would be more performant, since you are not executing the 
jQuery function in that case.


-- Josh


- Original Message - 
From: Namlet [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 19, 2008 1:11 PM
Subject: [jQuery] Re: Simple question about Radio Buttons



Well I fixed it, I had to use:

$(this).attr(checked)

to get the value.  Should I have known this?


On Sep 19, 2:48 pm, Namlet [EMAIL PROTECTED] wrote:

Why does this line of code not work for the radio button?

if ($(this).attr(type) == radio) alert($(this).checked);

I get 6 alert boxes (I have 6 Radio Buttons) and the alert says
undefined every time. But half of them should be true and half should
be false. Am I doing something wrong?

here are two of the radios:

input name=recvd_loan type=radio value=1 / Yes
input name=recvd_loan type=radio value=0 / No

Thanks! 




[jQuery] Re: Best JQuery pop-up plugin.

2008-09-18 Thread Josh Nathanson


jqModal does have a callback for that, but it gets pretty ugly if you're 
using the same modal window for different forms.  Then you have to 
re-configure the jqModal settings on each modal request.


What I've done is use a combination of the ajaxForm plugin and LiveQuery to 
listen for modal forms when they are requested.  When the modal form 
enters the dom, LiveQuery binds the ajaxForm so that the form is handled 
when it is submitted.  Then you just close the modal and you're done.  That 
way you're not trying to handle everything through the modal callbacks.


-- Josh


- Original Message - 
From: GasGiant [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, September 18, 2008 10:49 AM
Subject: [jQuery] Re: Best JQuery pop-up plugin.



Do any of them have a callback type of function for what to do on
close? I'd like to use a modal form that updates the Ajax in the
opener, but only when the modal get's closed.

On Sep 18, 1:43 pm, MorningZ [EMAIL PROTECTED] wrote:

I've had great luck/usage with jqModal

(http://dev.iceburg.net/jquery/jqModal/)

very configurable and easy to setup 




[jQuery] Re: How do I update my control after I submit data to my database?

2008-09-13 Thread Josh Nathanson


You can return whatever you want, by outputting the value from your php 
page...I would use Firebug and do console.log( data ) in your callback so 
you can make sure that it's returning the expected value.


-- Josh

- Original Message - 
From: jmDesktop [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 12, 2008 3:29 PM
Subject: [jQuery] Re: How do I update my control after I submit data to my 
database?




Thank you.  I don't think it will be json though.  What if it is not
json?

On Sep 12, 6:14 pm, Josh Nathanson [EMAIL PROTECTED] wrote:

You would do this in the callback function from the ajax call. One way
might be to have an empty div available on your page:
div id=username/div

Then the ajax callback, assuming you are returning json data:
function( data ) { $(#username).text( data.username ); }

-- Josh



- Original Message -
From: jmDesktop [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 12, 2008 2:48 PM
Subject: [jQuery] How do I update my control after I submit data to my

database?

 If I use jQuery .ajax to submit to my myUpdate.php file, after I do
 that, how do I then update my control that I submitted the information
 to update in the first place?

 For example, I have username textbox on a form, and I submit that
 username to a database. I then have a div or label that needs to show
 that newly submitted username if it is submitted to teh database
 correctly.

 I know how to submit the context of the textbox username to the
 database (.ajax,etc.), but not how to refresh that part of the page to
 show the database content.

 Thank you for any links or help.- Hide quoted text -

- Show quoted text - 




[jQuery] Re: IE ajax request giving the same result every time it's called

2008-09-12 Thread Josh Nathanson


IE always caches the response, so you have to explicitly set cache=false in 
your ajax call.  You can either do that on your specific ajax call, or 
globally via the $.ajaxSetup function.  Consult the jQuery docs - Ajax 
section for more information.


-- Josh


- Original Message - 
From: ch2450 [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 12, 2008 1:16 PM
Subject: [jQuery] IE ajax request giving the same result every time it's 
called





Hi,
Every ten seconds I'm checking the id of the last entry in my
database. For this purpose I'm using a GET ajax request calling a
really simple PHP code.
This step works wonderfully for Firefox and Safari on PCs and Macs. IE
however seems to return the same number over and over (the number it
got from its first request), although I'm positive that the db has
been updated correctly.
Anyone familiar with this random behavior from IE?

Clem. 




[jQuery] Re: How do I update my control after I submit data to my database?

2008-09-12 Thread Josh Nathanson


You would do this in the callback function from the ajax call.  One way 
might be to have an empty div available on your page:

div id=username/div

Then the ajax callback, assuming you are returning json data:
   function( data ) { $(#username).text( data.username ); }

-- Josh


- Original Message - 
From: jmDesktop [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 12, 2008 2:48 PM
Subject: [jQuery] How do I update my control after I submit data to my 
database?





If I use jQuery .ajax to submit to my myUpdate.php file, after I do
that, how do I then update my control that I submitted the information
to update in the first place?

For example, I have username textbox on a form, and I submit that
username to a database.  I then have a div or label that needs to show
that newly submitted username if it is submitted to teh database
correctly.

I know how to submit the context of the textbox username to the
database (.ajax,etc.), but not how to refresh that part of the page to
show the database content.

Thank you for any links or help. 




[jQuery] Re: Fire events programmatically

2008-09-08 Thread Josh Nathanson


Isn't that the same as this:

$(#ID1).trigger(change);

-- Josh


- Original Message - 
From: Huub [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Monday, September 08, 2008 11:30 AM
Subject: [jQuery] Fire events programmatically




Sometimes it's needed to create an event programmatically. (Which is
different from running an event function (triggering)

This can be done by the following fire code

var el=document.getElementById(ID1)

fire(el,'change')


  function fire(evttype) {
  if (document.createEvent) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent( evttype, false, false);
el.dispatchEvent(evt);
  } else if (document.createEventObject) {
el.fireEvent('on' + evttype);
  }
  }
looks like this trick is not yet in jQuery, perhaps for a reason?

Huub

Regards


[jQuery] Re: Cappucino's FlickrDemo in 45 lines of jQuery

2008-09-05 Thread Josh Nathanson


Thanks Ben, that's really cool that you did that.

-- Josh


- Original Message - 
From: Ben Sargent [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, September 05, 2008 10:22 AM
Subject: [jQuery] Cappucino's FlickrDemo in 45 lines of jQuery




After reading about the release of the Cappuccino web application
framework a few days ago, I thought I'd take a stab at re-implementing
one of their demos in jQuery. Cappuccino is obviously a huge framework
with tons of features, but I don't think jQuery can be dismissed quite
so easily in favour of something so heavy.

This took me about 3 hours. It's probably not perfectly optimized, and
I took a few CSS shortcuts that only work in Gecko and WebKit.

http://www.brokendigits.com/2008/09/05/cappucinos-flickrdemo-in-45-lines-of-jquery/

Enjoy!

ben 




[jQuery] Re: Not selector help

2008-09-03 Thread Josh Nathanson


This should do it...

$(input:checkbox:not(#myid)).attr(checked,false);

-- Josh


- Original Message - 
From: Brad [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, September 03, 2008 11:57 AM
Subject: [jQuery] Not selector help




I'm looking for the quickest way to uncheck all of the checkboxes on a
page except for one with a given idea. I realize I could uncheck all,
then check one, but I'm curious if I can leverage not: to accomplish
what I want to do?


[jQuery] Re: equivalent to prototype's invoke?

2008-08-27 Thread Josh Nathanson


You need to do this:

$(#div1, #div2).hide();

Both selectors go inside the quotes.  Otherwise, you are passing 2 arguments 
to jquery, and the second argument sets the context for the selector search.


-- Josh


- Original Message - 
From: riegersn [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, August 27, 2008 10:47 AM
Subject: [jQuery] equivalent to prototype's invoke?




I recently made the switch to jQuery and i'm happy I did so far.
However I'm missing my trusty invoke method from prototype.

invoke:
$('div1', 'div2').invoke('hide');

this is how im doing it now...
$.each(['#div1', '#div2'], function(i, s){ $(s).show() });

I tried $('#div1', '#div2').hide(); thinking it would surely work but
doesn't. Any advise? There has to be an easier way to do this.

Thanks,
Shawn 




[jQuery] Re: calling functions inside pages loaded by AJAX

2008-08-20 Thread Josh Nathanson


Gregg, try $(document).ready instead of $('document').ready and see how that 
works.



-I can't figure out how to make a call from the loading page into the
loaded page; everything I try it seems the script functions from the
loaded page are not known by the DOM.


Check this link:
http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F

-- Josh


- Original Message - 
From: gregg [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, August 20, 2008 10:48 AM
Subject: [jQuery] calling functions inside pages loaded by AJAX




I'm admittedly new to JQuery, although I'm rather experienced
javascript programmer.

I have an application which uses JQuery to load an HTML page through
AJAX. I have logic, implemented as javascript functions, inside the
page being loaded which I'd like to invoke after the page load is
complete and the DOM is updated w/ all the HTML tags inside that page.
I can't figure out how to do this.

-I've tried using $('document').ready(...) within the loaded page; it
gets invoked before the DOM is accessible.
-I've tried using $(window).bind(load, function () { within the
loaded page; it never gets invoked.
-I can't figure out how to make a call from the loading page into the
loaded page; everything I try it seems the script functions from the
loaded page are not known by the DOM.

Does anyone have a good suggestion for how best to set this up?

Currently the loading page looks something like this:

   $(#myWin).load(url, function() {
   window.onPageLoad();  // this fails w/ object expected, or
objec does not suppor this method JS errors
});


within the page being loaded I have something like this:
function onPageLoad() {
   
}

any help would be appreciated.

-Gregg 




[jQuery] Re: $.ajax() timeout

2008-08-20 Thread Josh Nathanson


timeout is actually how long the request will wait to complete before it 
sends back a timeout error.  You actually want setTimeout, like so.  This 
will wait five seconds before doing the ajax request.


var t = setTimeout( function() {
  $.ajax({
  type: GET,
url: myurl.com,
  beforeSend: function() {
  $(#adminToolsListingA .scroll).html();
 $(#adminToolsListingA .ajaxLoading).show();
 },
 success: function(html) {
  $(#adminToolsListingA .ajaxLoading).hide();
  $(#adminEditListingA .scroll).html(html);
   }
   });
   }, 5000 );

-- Josh


- Original Message - 
From: hubbs [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, August 20, 2008 11:25 AM
Subject: [jQuery] $.ajax() timeout




I seem to not be understanding how the ajax timeout works, because it
does not seem to work how I thought.

I was hope it would delay the ajax request, for the number of
miliseconds that is specified, but that does not seem to be working.
Is the timeout used for something different?  Or is there a different
way to delay an ajax request for a few seconds?

Using:

   $.ajax({
   type: GET,
timeout: 5000,
   url: myurl.com,
   beforeSend: function() {
   $(#adminToolsListingA .scroll).html();
   $(#adminToolsListingA .ajaxLoading).show();
   },
   success: function(html) {
   $(#adminToolsListingA .ajaxLoading).hide();
   $(#adminEditListingA .scroll).html(html);
   }
   });





[jQuery] Re: New CF programmer - anxious to start using jQuery

2008-08-20 Thread Josh Nathanson



Did I forget to mention I'm  Coldfusion programmer? I this all
specifically for javascript programmers? Interesting stuff but no
mention of how to apply it. The demo doesn't even work correctly.


Larksys - there isn't really anything special about using jQuery along with 
ColdFusion.  ColdFusion is a server technology, while jQuery/javascript are 
client technologies, so the two don't overlap or interfere with each other. 
You can just include your jQuery code in your ColdFusion templates and 
everything should work fine.


One thing that's really important in doing javascript work is to get the 
Firebug development tool for Firefox.  This will help you immensely in 
troubleshooting problems which inevitably occur.


http://getfirebug.com/

I'd recommend checking out some tutorials on the jquery site, there's a 
wealth of information there to help you get started.


-- Josh

- Original Message - 
From: larksys [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, August 20, 2008 1:50 PM
Subject: [jQuery] Re: New CF programmer - anxious to start using jQuery




Did I forget to mention I'm  Coldfusion programmer? I this all
specifically for javascript programmers? Interesting stuff but no
mention of how to apply it. The demo doesn't even work correctly. 




[jQuery] Re: Is there a plugin to zoom in/out an image

2008-07-17 Thread Josh Nathanson


Colin, check out my Magnify plugin, it's not zooming but it does allow you 
to see finer details of an image.


http://plugins.jquery.com/project/magnify

-- Josh

- Original Message - 
From: Colin Guthrie [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, July 17, 2008 9:14 AM
Subject: [jQuery] Re: Is there a plugin to zoom in/out an image




Andy Matthews wrote:

None of those plugins that you mentioned are for zooming in and out of
images. They simply display a larger version of the image as an overlay 
to

the page.


Ahh OK, It's just when you said like shopping carts and this is what
I've mostly seen shopping carts do (larger overlay) rather than sort of
interactive zoom like you seem to want.

Sorry.

Col





[jQuery] Re: PLUGIN: prettyPhoto v2.1.1 a jQuery lightbox clone released

2008-07-15 Thread Josh Nathanson


That is luscious.  Great job Stephane.

-- Josh


- Original Message - 
From: Rey Bango [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Monday, July 14, 2008 2:34 PM
Subject: [jQuery] PLUGIN: prettyPhoto v2.1.1 a jQuery lightbox clone 
released





prettyPhoto v2.1.1 a jQuery lightbox clone released

http://www.no-margin-for-errors.com/projects/prettyPhoto/ 




[jQuery] Re: Finding position among siblings

2008-07-15 Thread Josh Nathanson


Check into the index() method.

-- Josh

- Original Message - 
From: ml1 [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Tuesday, July 15, 2008 8:57 AM
Subject: [jQuery] Finding position among siblings




Is there an efficient, cross browser jquery way to find a node's
position among it's siblings?

Ie if I have ten div nodes next to each other and the user clicks on
the third one, what's the best way to tell that it's the third one?

Thanks!


[jQuery] Re: Extra AJAX calls being made

2008-07-11 Thread Josh Nathanson


Usually this indicates that somehow, you are rebinding the event handler to 
the button on each ajax call.  Each time you do a binding, it is additive --  
there is nothing to check and see if the event handler is already bound. 
Check your logic and make sure you are only binding the event handler to the 
button once.


-- Josh


- Original Message - 
From: Dustin [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, July 11, 2008 8:43 AM
Subject: [jQuery] Extra AJAX calls being made




I'm working on an app that uses Jquery and the BlockUI plugin. An odd
problem I'm having is that there are extra ajax calls being made. For
every Ajax call I make, and the number of calls made increments. In
other words, the initial ajax call is made by clicking a button in a
message I display with BlockUI. The next time the message pops up and
I click the button, TWO ajax calls are made instead of one. The next
time, three, then four, then five, and it continues to increment every
time. Any idea of what could be going on? 




[jQuery] Re: Extra AJAX calls being made

2008-07-11 Thread Josh Nathanson


Yep, if you remove the elements, the event bindings are gone as well.

-- Josh

- Original Message - 
From: Dustin [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, July 11, 2008 11:04 AM
Subject: [jQuery] Re: Extra AJAX calls being made



Yep, you were right! I was rebinding the events every time the message
box popped up.

Here is a question though...with the message box (which contains the
buttons I'm binding events to), I am essentially just displaying and
hiding it...not creating and deleting it. If I were to completely
remove it from the page would I need to rebind the events?

Thanks!

On Jul 11, 12:38 pm, Josh Nathanson [EMAIL PROTECTED] wrote:
Usually this indicates that somehow, you are rebinding the event handler 
to
the button on each ajax call. Each time you do a binding, it is 
additive -- 
there is nothing to check and see if the event handler is already bound.
Check your logic and make sure you are only binding the event handler to 
the

button once.

-- Josh

- Original Message -
From: Dustin [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Friday, July 11, 2008 8:43 AM
Subject: [jQuery] Extra AJAX calls being made

 I'm working on an app that uses Jquery and the BlockUI plugin. An odd
 problem I'm having is that there are extra ajax calls being made. For
 every Ajax call I make, and the number of calls made increments. In
 other words, the initial ajax call is made by clicking a button in a
 message I display with BlockUI. The next time the message pops up and
 I click the button, TWO ajax calls are made instead of one. The next
 time, three, then four, then five, and it continues to increment every
 time. Any idea of what could be going on? 




[jQuery] Re: Running a loop for array numbers

2008-07-08 Thread Josh Nathanson


Try this for the first one:

$('.equipment a.i-right1').not(':eq(0)').hide();

For the second one, check out the slice() method.

-- Josh

- Original Message - 
From: JohneeM [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Tuesday, July 08, 2008 10:00 AM
Subject: [jQuery] Running a loop for array numbers




Hi guys how can i run this in a single statement without manually
putting in the numbers?

$('.equipment a.i-right1:eq(1)').hide();
$('.equipment a.i-right1:eq(2)').hide();
$('.equipment a.i-right1:eq(3)').hide();
$('.equipment a.i-right1:eq(4)').hide();
$('.equipment a.i-right1:eq(5)').hide();
$('.equipment a.i-right1:eq(6)').hide();
$('.equipment a.i-right1:eq(7)').hide();
$('.equipment a.i-right1:eq(8)').hide();


Note that im skipping the first array [0] due to wanting it to show.


Also this one :

   $('.performance-parts #content-container
a.lightbox:eq(8)').lightBox();
   $('.performance-parts #content-container
a.lightbox:eq(9)').lightBox();

They need to be in their own array as i want to run a seperate
lightbox for each image, is this possible?



Thanks.


[jQuery] Re: firefox error NS_ERROR_XPC_JS_THREW_STRING with ajax form submission

2008-07-04 Thread Josh Nathanson



Error: [Exception... 'Permission denied to call method
XMLHttpRequest.open' when calling method:
[nsIDOMEventListener::handleEvent]


Usually you get this error when you are trying to do an ajax call to a 
different domain than the calling template is on.  That's a no-no.  There 
are ways around it, such as JSONP or using a server proxy.


-- Josh

- Original Message - 
From: Colin Manning [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Friday, July 04, 2008 8:45 AM
Subject: [jQuery] firefox error NS_ERROR_XPC_JS_THREW_STRING with ajax form 
submission





Hi

Have a problem that shows with firefox (2.0.0.15 on Windows) but not with
IE (6). I'm using the Form plugin with a trivial form. I'm using a call to
$.ajaxForm() to do an ajax form submission.

It never works with firefox, and instead I get this really user friendly
error message in the error console:
Error: [Exception... 'Permission denied to call method
XMLHttpRequest.open' when calling method:
[nsIDOMEventListener::handleEvent]  nsresult: 0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)  location: unknown  data: no]

Note, this is not fixed by sticking autocomplete=off  into the input
controls (some versions of firefox seem to have bugs in autocomplete that
can lead to this kind of problem; adding autocomplete=off is supposed to
work round that but it makes no difference here).


Here is a cutdown sample html that demos the problem. You'll note that 
I've
set handlers on the ajaxForm() call to output the request and response, 
but

otherwise do nothing. When run on IE this does exactly what you'd expect -
you see an alert before the ajax request is sent, and another when the
response is received, and the page remains loaded in the browser. On
firefox the first alert appears ok but the response alert never shows,
instead you get the above error and the browser then changes the displayed
page to be the ajax response text from the server.

Any ideas?

--

!DOCTYPE html
PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml; lang=en-US xml:lang=en-US
head
script src=jquery-1.2.6.js type=text/javascript/script
script src=jquery.form.js type=text/javascript/script
/head

body

form method=get action=(url removed) id=rc_form
input autocomplete=off type=text name=uv /
input autocomplete=off type=submit name=.submit value=Search /
/form

script type=text/javascript
$(function(){
$('#rc_form').ajaxForm({ beforeSubmit:
function(formData, jqForm, options) {
var queryString = $.param(formData);
alert('About to submit: \n\n' +
queryString);
return true;
},
 success:
function (responseText, statusText) {
alert('status: ' + statusText +
'\n\nresponseText: \n' + responseText);
}
  });
});
/script
/body
/html


--


Thanks
Colin


At 22:08 16/06/2008, you wrote:



Hi

Newbie user and I guess this probably has a simple answer.

I have a hidden div on the page that is shown when user clicks a button.
Its a help text, in a div, for the page that is only to be shown when the
user wants it. But the page is long and when I un-hide the div I also want
the browser to scroll the document so as to ensure this div actually
visible within the browser window.

Is there an easy way in jQuery to ensure a given element is actually
visible on screen and not scrolled off the bottom?


Thanks
Colin


--
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008
18:02






--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008
18:02



--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008 
18:02







[jQuery] Re: Navigate away after ajax call?

2008-07-03 Thread Josh Nathanson


It works because it's asynchronous.  The $.get call is fired, and then the 
script continues along its merry way, without waiting for the return of the 
$.get call.


-- Josh

- Original Message - 
From: wsw [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, July 03, 2008 11:16 AM
Subject: [jQuery] Navigate away after ajax call?




My code:

---in the script---
$('a').click(function() {
$.get('/long_running_page');
return true;
}

---on the page---
a href=http://www.otherserver.com;click here/a.


This appears to work. The long running page finishes (writes a file on
the server) even though I've navigated to otherserver.com by the time
it's done. Is this documented behavior or am I getting lucky?

Thanks! 




[jQuery] Re: Best way to detect between jQuery triggered event and actual browser-based event...

2008-06-30 Thread Josh Nathanson


Hmmm...that hasn't come up for me yet.  Seems like the way you're doing it 
would be the way to go for now.


Maybe in the next jQuery version they could add a key internalTrigger or 
something like that to the event object when the trigger method is run.


-- Josh

- Original Message - 
From: Dan G. Switzer, II [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Monday, June 30, 2008 3:26 PM
Subject: [jQuery] Best way to detect between jQuery triggered event and 
actual browser-based event...





Just curious as to everyone's recommendations on detecting the difference
between a jQuery created event object (i.e. $(#el).trigger(click)) and 
a

real event object (i.e. create by the browser.)

Right now I'm doing:

if( !(ctrlKey in e) )

I believe the ctrlKey should be sent by every browser when the event 
action
occurs via a user's action, but just wanted to know if there's a better 
way.


It would be really nice if jQuery would pass a key that indicates whether 
an

event object is generated by the browser or by jQuery. I've come across a
few occasions were I needed to do different things based on how the event
was being triggered.

-Dan





[jQuery] Re: Adding hover to all table rows (tr) but the first one.

2008-06-26 Thread Josh Nathanson


Would this work as well?

$(tr:not(:first):not(:last)).hover(function() { //etc.

Not as performant as the other ones, but expresses the intent clearly.

-- Josh


- Original Message - 
From: Karl Swedberg [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, June 26, 2008 11:15 AM
Subject: [jQuery] Re: Adding hover to all table rows (tr) but the first one.




Hi again,

you replied directly to me with this:


Awesome! Now 1 more question.

How can I have it not hover the last row too?


Hope you don't mind that I'm posting a response to this question on  the 
list. I'd like other people to be able to see the answer as well,  just in 
case someone else might have the same question later on...


Instead of using :gt(0) within the selector expression, you can use  the 
slice method -- .slice(1,-1)


So it would look like this:

$('tr').slice(1, -1).hover(function() {
 // Stuff to do when the mouse enters the row;
}, function() {
 // Stuff to do when the mouse leaves the row;
});

Cheers,

--Karl

On Jun 26, 2008, at 12:23 PM, Karl Swedberg wrote:



Hi,

you should be able to do it like so:


$('tr:gt(0)').hover(function() {
 // Stuff to do when the mouse enters the row;
}, function() {
 // Stuff to do when the mouse leaves the row;
});


--Karl

Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jun 26, 2008, at 11:27 AM, aldomatic wrote:



I'm having a difficult time figuring out how to add a hover effect on
all but the first table row (tr).

I appreciate anyone's help.

Thanks!








[jQuery] Re: [validate] Validation Plugin issue when using TinyMCE

2008-06-24 Thread Josh Nathanson


I think maybe you want element.is(textarea) (no colon)

Otherwise that part of the conditional will never fire.

-- Josh


- Original Message - 
From: shapper [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Tuesday, June 24, 2008 4:23 PM
Subject: [jQuery] Re: [validate] Validation Plugin issue when using TinyMCE



You mean the { after the else? Yes, I noticed that before.
I keep having the same problem. The form is not validated when I use
errorPlacement.

I am using:

 $(#New).validate({
   errorClass: Error,
   errorElement: label,
   errorPlacement: function(error, element) {
 if (element.is(:textarea))
   error.insertAfter(element.next());
 else
   error.insertAfter(element);
   },
   rules: {
 Answer: {required: true},
 Question: {required: true}
   },
   messages: {
 Answer: {required: Insert an answer},
 Question: {required: Insert a question}
}
 });

Any idea?

Thanks,
Miguel


On Jun 24, 11:18 pm, Jörn Zaefferer [EMAIL PROTECTED]
wrote:

There was a syntax error in the errorPlacement, try this:

errorPlacement: function(error, element) {
if (element.is(:textarea))
error.insertAfter(element.next());
else
error.insertAfter(element);
},

On Tue, Jun 24, 2008 at 11:36 PM, shapper [EMAIL PROTECTED] wrote:

 Hello,

 I have been trying to make JQuery Validation with TinyMCE and until
 now I wasn't able to do this. I have 2 text areas converted to
 TinyMCE. I am using:

 $(#New).validate({
 errorClass: Error,
 errorElement: label,
 errorPlacement: function(error, element) {
 if (element.is(:textarea))
 error.insertAfter(element.next());
 else {
 error.insertAfter(element);
 },
 rules: {
 Answer: {required: true},
 Question: {required: true}
 },
 messages: {
 Answer: {required: Insert an answer},
 Question: {required: Insert a question}
 }
 });

 Using this code does not even validate. The form is submited. If I
 remove the errorReplacement part then it works but the error message
 is out of place.

 I tried many options but until now I wasn't able to make this work.

 Any idea how to solve this?

 Thanks,
 Miguel

 On Jun 24, 3:01 pm, Jörn Zaefferer [EMAIL PROTECTED]
 wrote:
 How about this:

 errorPlacement: function(error, element) {
 if (element.is(:textarea))
 error.insertAfter(element.next());
 else {
 error.insertAfter(element);

 }

 Jörn

 On Tue, Jun 24, 2008 at 2:18 PM, shapper [EMAIL PROTECTED] wrote:

  Hello,

  I checked the markup used by TinyMCE and it is something as follows:

  label for=QuestionQuestion/label
  textarea id=Question cols=20 rows=10 name=Question
  style=display: none;/
  span id=Question_parent class=mceEditor BonsAlunosSkin
  table id=Question_tbl class=mceLayout cellspacing=0
  cellpadding=0 style=width: 538px; height: 175px;
  tbody
  .
  /tbody
  /table
  /span

  So the textarea is disabled and replaced by a span and table ...

  I then changed my validation code to:

  $(#New).validate({
  errorClass: Error,
  errorElement: label,
  rules: {Question: {required: true}},
  errorPlacement: function(error, element) {
  if (element.is(:textarea))
  error.appendTo(element.parent().next().next('textarea'));
  }
  });

  This is not working. Could you, please, tell me what am I doing 
  wrong?

  I also tried with table but no success.

  On Jun 23, 9:57 am, Jörn Zaefferer [EMAIL PROTECTED]
  wrote:
  Most likely TinyMCE creates a new element and places it after the
  textarea, hiding the former. Use the errorPlacement-option to
  customize the placement for that case.

  Jörn

  On Mon, Jun 23, 2008 at 1:54 AM, shapper [EMAIL PROTECTED] wrote:

   Hello,

   I have the following rules:

   $(#New).validate({
   errorClass: Error,
   errorElement: label,
   rules: {Answer: {required: true}},
   });

   Applied to text area:

   label for=Answer class=RequiredResposta/label
   textarea name=Answer rows=10 cols=20 id=Answer/
   textarea

   This works fine. The error labels shows after the TextArea.
   The moment I use TinyMCE (http://tinymce.moxiecode.com/) to make 
   the

   Text Area an HTML WYSIWYG editor I get a problem:

   The error label shows before the text area and after the label!

   Any idea what might be wrong? How can I solve this?

   Thanks,
   Miguel 




[jQuery] Re: .load() post issues

2008-06-19 Thread Josh Nathanson


Ferric - I believe (though I'm not totally sure) that .load uses a get 
rather than a post.  Try doing url.albumID rather than form.albumID in 
your ColdFusion code and see how that works.


-- Josh

- Original Message - 
From: ferric84 [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Thursday, June 19, 2008 8:29 AM
Subject: [jQuery] .load() post issues




I'm having a problem getting my server side script to see the
variables posted by a .load().  Consider this code snippet:

$('#modal_editphotos').load('/includes/members/ajax_edit_album.cfm',
{ albumID: 3 });

Given that it is coldfusion, I should be able to access the variable
albumID with form.albumID, however, the response is a 500 error
saying that albumID does not exist.  A GET method works fine
(referring to albumID as url.albumID), but I cannot for the life of
my figure out why these vars are not being sent correctly.  Firebug
reports that the variables are being sent (albumID=3).

Any ideas why I cannot access this POST variable? 




[jQuery] Re: Why do i keep getting: test is not defined!

2008-06-19 Thread Josh Nathanson


Your function is fine, however when you *call* the function removeItem, 
you'll need to pass in two arguments -- otherwise obj will be undefined:


removeItem('myitem'); // obj is undefined
removeItem('myitem', myobject); // obj is defined

-- Josh


- Original Message - 
From: Mark [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, June 19, 2008 4:02 PM
Subject: [jQuery] Why do i keep getting: test is not defined!




hey,

function removeItem(name, obj)
{
   var answer = confirm(Are you sure you want to delete:  + name + ?)
   var test = obj;

   if (answer)
   {
   $(test.parentNode.parentNode).fadeOut(slow);
   }
}

the code is simple and still not working.. the issue is that i try to
call a variable in a if that wasn't made there.. but how can i resolve
that?
Why is javascript not working how you would expect it to work :S i
know Java and PHP well and things like this are no issue in them.

o and in this code i already put obj in test.. i've tried it with obj
first but that gave the same error as in the title.

Thanx. 




[jQuery] Re: Why do i keep getting: test is not defined!

2008-06-19 Thread Josh Nathanson



Now why is this not working with a href?
I have just no clue.


My guess is that the context doesn't resolve correctly when you do 
javascript: in the href, so when you do this.parentNode, it probably 
thinks this is the window object, which doesn't have a parent node.  Thus 
it returns undefined.


When you do onclick it knows the context is that a node so it works 
properly.


Also, if you are getting into jQuery, I'd suggest learning a little bit 
about unobtrusive javascript, that is, not putting your event handler code 
inline.  This helps you keep your html markup and your JS code separated.


-- Josh


- Original Message - 
From: Mark [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, June 19, 2008 4:13 PM
Subject: [jQuery] Re: Why do i keep getting: test is not defined!




Thanx for the fast reply!
I just now found why it was not working..

With this it works:
a onclick=removeItem('something', this.parentNode);click/a

with this not (will give the freaking error):
a href=javascript:removeItem('something', this.parentNode);click/a

Now why is this not working with a href?
I have just no clue.


On Fri, Jun 20, 2008 at 1:08 AM, Josh Nathanson [EMAIL PROTECTED] 
wrote:


Your function is fine, however when you *call* the function removeItem,
you'll need to pass in two arguments -- otherwise obj will be undefined:

removeItem('myitem'); // obj is undefined
removeItem('myitem', myobject); // obj is defined

-- Josh


- Original Message - From: Mark [EMAIL PROTECTED]
To: jquery-en@googlegroups.com
Sent: Thursday, June 19, 2008 4:02 PM
Subject: [jQuery] Why do i keep getting: test is not defined!




hey,

function removeItem(name, obj)
{
  var answer = confirm(Are you sure you want to delete:  + name + ?)
  var test = obj;

  if (answer)
  {
  $(test.parentNode.parentNode).fadeOut(slow);
  }
}

the code is simple and still not working.. the issue is that i try to
call a variable in a if that wasn't made there.. but how can i resolve
that?
Why is javascript not working how you would expect it to work :S i
know Java and PHP well and things like this are no issue in them.

o and in this code i already put obj in test.. i've tried it with obj
first but that gave the same error as in the title.

Thanx.







[jQuery] Re: New jQuery Plug-in: Multicolumn Dropdown

2008-06-18 Thread Josh Nathanson


Very nice!

One small issue...if I click in the main part of the dropdown, rather than 
on the down arrow, I can't select any options with the mouse.  This is a 
little different than a native select control, where you can click anywhere 
on it.


-- Josh




- Original Message - 
From: Dan G. Switzer, II [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Wednesday, June 18, 2008 8:31 AM
Subject: [jQuery] New jQuery Plug-in: Multicolumn Dropdown




Awhile back I blogged about a plug-in that my company was planning on
releasing called mcDropdown (multicolumn dropdown.)

Well, the plug-in was officially released today:
http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm

If you like the plug-in, feel free to digg it:
http://digg.com/programming/Multicolumn_Dropdown_jQuery_Plug_in

You can jump directly to the example here:
http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm#example

In a nutshell, this plug-in creates a tree-like form control. We need a UI
control that would allow users to select an option from a large tree of 
data

and this was the end result.

I think the overall effect is pretty impressive and I've never seen a UI
control like it (especially considering it supports keyboard entry.)

-Dan





[jQuery] Re: Basic newbie question - ''Object doesn't support this property or method

2008-06-18 Thread Josh Nathanson



$('span').addclass('red');


addClass has to be camel case - javascript is case-sensitive.

-- Josh

- Original Message - 
From: weegekid [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, June 18, 2008 7:48 AM
Subject: [jQuery] Basic newbie question - ''Object doesn't support this 
property or method





Hi All,

I'm just starting out trying to learn JQuery and I have a very Newbie
question.  I've tried to use the following code to get the link to
change the span text red but get an 'Object doesn't support this
property or method' error when I click the link:

--code--

script language=javascript
$(document).ready(function() {
$(a[rel='redlink']).bind('click', function() {
$('span').addclass('red');
});

});
/script
style type=text/css
.red {
color: red;
}
/style
/head
body
pa href=javascript: void(0); rel=redlinkclick me/a/p
pEu fugiat nulla pariatur. spanQui officia deserunt lorem ipsum
dolor sit amet,/span quis nostrud exercitation. Cupidatat non
proident./p
/body
/html

--end code--

Thanks for any explanation! Again, I'm just a newbie starting out. 




[jQuery] Re: Quick question about dimensions

2008-06-18 Thread Josh Nathanson


The offset() method is only gettable, not settable.

You might need to do something like this:

$(#insertLink).click(function(){
   var offset = $(this).offset();
   $(#insertDiv).css({ top: offset.top, left: offset.left }).toggle();
});

-- Josh

- Original Message - 
From: eric [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, June 18, 2008 10:13 AM
Subject: [jQuery] Quick question about dimensions




I've recently been exploring the jquery library and I apologize if
this is a silly question. But could someone post a simple example of
using the dimension library to position a div directly below a link. I
have tried something like this:

   $(#insertLink).click(function(){
   $(#insertDiv).offset($(this).offset());
   $(#insertDiv).toggle();
   });

but it doesn't seem to work. Am I missing something? 




[jQuery] Re: SproutCore vs jQuery? Are there any comparisons out there?

2008-06-17 Thread Josh Nathanson


On the SproutCore site, it talks about it being a complete MVC type 
framework.  This is a different approach than jQuery.  It reminded me a bit 
of Spry.


The SproutCore guy did a presentation at the SF Javascript Meetup a couple 
of months ago, and it sounded pretty interesting.


-- Josh

- Original Message - 
From: Andy Matthews [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Tuesday, June 17, 2008 8:54 AM
Subject: [jQuery] Re: SproutCore vs jQuery? Are there any comparisons out 
there?





Yeah...that's what I thought. I've never even heard of it before WWDC.

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Rey Bango
Sent: Tuesday, June 17, 2008 10:29 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: SproutCore vs jQuery? Are there any comparisons out
there?


There are no comparisons out at the moment. While SproutCore has recently
received a lot of press, it's been completely out of the limelight
otherwise.

Rey...

Andy Matthews wrote:

I'm looking for comparisons between the newly popular JS library
SproutCore and our own favorite, jQuery.

Mostly I'm looking for feature comparisons in the area of data binding
and UI.

SproutCore's got to be good if Apple decided to use it for their
recerntly announced MobileMe online app. But why? Why not jQuery, or
Dojo, etc?


*


Andy Matthews
*Senior ColdFusion Developer

Office:  615.627.9747
Fax:  615.467.6249
www.dealerskins.com http://www.dealerskins.com/

Total customer satisfaction is my number 1 priority! If you are not
completely satisfied with the service I have provided, please let me
know right away so I can correct the problem, or notify my manager
Aaron West at [EMAIL PROTECTED]








  1   2   3   4   >