[jQuery] Re: Livequery not binding on div after a .load method

2008-04-27 Thread Alexandre Plennevaux
the thing is i'm not sure the load event is the right one to bind livequery
to in your case. I personally would bind it to the click event triggering
the ajax call.

On Sat, Apr 26, 2008 at 11:26 PM, minskmaz [EMAIL PROTECTED] wrote:


 That's a really good catch Alexandre, however it didn't solve the
 problem. The title still doesn't display the newly loaded #pagetitle
 class attribute...

 ~MM

 On Apr 26, 2:12 pm, Alexandre Plennevaux [EMAIL PROTECTED]
 wrote:
  correct me if i'm wrong but i think livequery needs to know on which
 event
  type it should be attached to:
 
  so something like this  _
 
  $(#pagetitle)
  .livequery('load',function() {
   //alert($(this).attr(class));
  $(title).text($(this).attr(class));
  return false;
   });
 
  see the doc for more info:http://brandonaaron.net/docs/livequery/




-- 
Alexandre Plennevaux
LAb[au]

http://www.lab-au.com


[jQuery] Validate plugin problem

2008-04-27 Thread Tomas GF


I'm using jQuery Validate (v. 1.2.1) on a page with several forms. I iterate
through the forms using each(). The validation is working but when I try to
append a loader (using ajaxStart()), it's appended to the wrong div (always
on the second form).


The code:


$(document).ready(function() {
  var loader = jQuery('#60;div id=loader#62;#60;img
src=_js/loading.gif alt=loader width=20
height=20#62;#60;/div#62;');
  $.validator.setDefaults({
debug: true,
focusInvalidElement: true,
submitHandler: function(form) {
  $(form).ajaxForm();
  var options = { target: $(form).parent(), clearForm: true, resetForm:
true }
  $(form).ajaxSubmit(options);
}
  });
  $(form).each(function(i){
$(this).validate();
$(this).ajaxStart(function(){
  $(this).parent().append(loader);
})
  });
});


Another problem is that IE 6 sends the message twice...

Thanks for your help.

-- 
View this message in context: 
http://www.nabble.com/Validate-plugin-problem-tp16912097s27240p16912097.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Livequery not binding on div after a .load method

2008-04-27 Thread Sid

I face the same problem.
New classes are simply not recognized, making my links disfunctional.


[jQuery] My jQuery Page

2008-04-27 Thread Sid

Hi ppl,
Came across jQuery recently. What I saw got me very excited.

sid-deswal.110mb.com

Please check the 'Bugs and Fixes' link on the page. If you know how to
resolve them, a post back or an email would be very appreciated.

Homepage checked on FF, IE 6, Opera and Safari (Win XP SP2, 1024x768)

Regards


[jQuery] Re: AJAX get method problem

2008-04-27 Thread David Frank

I should have read the official FAQ first, though I wasn't expecting
it to be answered in FAQ section...

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F

problem solves, hope this helps others.


[jQuery] How to bind to multiple elements

2008-04-27 Thread LostCore

Hi!

Well, i'll quickly describe my problem.

In a page, i've multiple occurrence of:

[code]
div id=images
div id=imagencap style=float:left;
img src=fileName.jpg /
p id=caption_id
caption_text
/p
/div
/div
[/code]

I would do, that when i click on a caption_text, the relative
paragraph tag hide, and a textarea appears, with the text of the p.

Then, i've scripted this:

[code]
$(#images).find(#imagencap)
.click(function(e){

if($(this).children().is(textarea)){ return; }

var myP = $(this).find(p);
var myCaption = myP.text();
var myId = myP.attr(id);

var textarea = textarea id=+myId++myCaption+/textarea;
var buttons = [a href='#'SAVE/a] [a href='#'CANCEL/a];
myP.hide();
myP.before(br /+textarea+br /+buttons);
});
[/code]

... That works!. But only for the first occurrence!

Where is the problem?

Thanks :)


[jQuery] Re: Cycle (fx:'custom' )

2008-04-27 Thread Mike Alsup

  Hails! I've been having a trouble with a custom effect on IE and
  Safari, but it works perfectly on Firefox, although Firebug shows the
  following message: [cycle] unknown transition: custom. It's not a
  error message, but I believe it has something to do with the bug in IE
  and Safari. Then, I tried turning the custom effect into a transition
  definition as the described in the Cycle documention (http://
  www.malsup.com/jquery/cycle/adv2.html) and now it works in the same
  way on Firefox, but without that message on Firebug.

Hi Eddie,

The log message you see is confusing and I'll fix that.  But you
haven't provided enough information for me to help with the real
problem.   Can you post a link?

Mike


[jQuery] Re: How to bind to multiple elements

2008-04-27 Thread Michael Geary

You can't have multiple elements with the same ID. That's why it only works
for the first one. Use classes instead.

That should be a straightforward change for the most part, the one exception
being the part where you grab the ID of the P element and assign that same
ID to the new TEXTAREA. Not sure what the intent there is.

Couple of little tips... With classes, $(#images).find(#imagencap) would
be $(.images).find(.imagencap), but you can simplify that (or any
similar code) to $(.images .imagencap), just like you would do in CSS.

Also, I find it helpful to use a $ prefix on variables that contain jQuery
objects. The $ reminds me that it's a jQuery object, and makes the code
where I use it look more like a jQuery call, e.g.

var $p = $(this).find(p);
var myCaption = $p.text();

Just a stylistic thing, but you might try it and see if you like it.

-Mike

 In a page, i've multiple occurrence of:
 
 [code]
   div id=images
   div id=imagencap style=float:left;
   img src=fileName.jpg /
   p id=caption_id
   caption_text
   /p
   /div
   /div
 [/code]
 
 I would do, that when i click on a caption_text, the 
 relative paragraph tag hide, and a textarea appears, with the 
 text of the p.
 
 Then, i've scripted this:
 
 [code]
   $(#images).find(#imagencap)
   .click(function(e){
 
   if($(this).children().is(textarea)){ return; }
 
   var myP = $(this).find(p);
   var myCaption = myP.text();
   var myId = myP.attr(id);
 
   var textarea = textarea 
 id=+myId++myCaption+/textarea;
   var buttons = [a href='#'SAVE/a] [a 
 href='#'CANCEL/a];
   myP.hide();
   myP.before(br /+textarea+br /+buttons);
   });
 [/code]
 
 ... That works!. But only for the first occurrence!
 
 Where is the problem?
 
 Thanks :)
 



[jQuery] Re: this pointer in Jquery ?

2008-04-27 Thread mumu

no

the goal was to use the this pointer of the a href, in order to be
sure to validate the good form

thanks anyway

On Apr 26, 9:32 pm, Ryura [EMAIL PROTECTED] wrote:
 script
 $(function() {
 $('form a').click(function() {
 $(this).parent('form').submit();
 return false;});
 });

 /script

  a href=# class=img ok/a

 Try that.

 On Apr 26, 1:38 pm, mumuri [EMAIL PROTECTED] wrote:

  Hello

  for the moment to submit a form ,i do like this (the a href is wrapped
  in a form tag)

  a href=javascript:$(.ok).parent('form').submit(); class=img
  ok/a

  but i would like to do like this

  a href=javascript:$(this).parent('form').submit(); class=img
  ok/a

  as this doesn't work i would like to know if there is a syntaxe for
  this


[jQuery] Re: How to bind to multiple elements

2008-04-27 Thread steve_f

Do you have multiple divs with the same id of 'images'?. if so you
need to start using class name selectors, then you can iterate all the
divs with that clas name e.g
 $(.images).each


On Apr 27, 11:25 am, LostCore [EMAIL PROTECTED] wrote:
 Hi!

 Well, i'll quickly describe my problem.

 In a page, i've multiple occurrence of:

 [code]
         div id=images
                 div id=imagencap style=float:left;
                         img src=fileName.jpg /
                         p id=caption_id
                         caption_text
                         /p
                 /div
         /div
 [/code]

 I would do, that when i click on a caption_text, the relative
 paragraph tag hide, and a textarea appears, with the text of the p.

 Then, i've scripted this:

 [code]
         $(#images).find(#imagencap)
         .click(function(e){

                 if($(this).children().is(textarea)){ return; }

                 var myP = $(this).find(p);
                 var myCaption = myP.text();
                 var myId = myP.attr(id);

                 var textarea = textarea 
 id=+myId++myCaption+/textarea;
                 var buttons = [a href='#'SAVE/a] [a 
 href='#'CANCEL/a];
                 myP.hide();
                 myP.before(br /+textarea+br /+buttons);
         });
 [/code]

 ... That works!. But only for the first occurrence!

 Where is the problem?

 Thanks :)


[jQuery] New delegate plugin: event delegation with submit/reset cross-browser

2008-04-27 Thread Klaus Hartl

Hi all,

I needed to use event delegation for submit/reset events, so I took
the solution from 
http://www.danwebb.net/2008/2/8/event-delegation-made-easy-in-jquery
(see Yehuda Katz's comment) and enhanced it with workarounds for IE
where these events do not bubble up. Also in Safari 2 submit doesn't
seem to bubble either. Plus there were some quirks when confirm() was
involved.

Get it here:
http://stilbuero.de/jquery/delegate/

I needed to do that quickly, thus the code could use some optimization
(later).

I just noticed that Jörn also wrote a delegate plugin which fixes
focus and blur events and we're going to merge the two.


--Klaus


[jQuery] Re: Livequery not binding on div after a .load method

2008-04-27 Thread Brandon Aaron

LiveQuery is actually working but jQuery's text method doesn't work on
the title tag. To check that it is working simply add a console.log
statement or uncomment your alert line. If you aren't getting the log
statement/alert then please post a more complete example.

--
Brandon Aaron

On Apr 26, 3:01 pm, Minsk Maz [EMAIL PROTECTED] wrote:
 I'm sure this isn't a bug. Here's the node I'm trying to grab --

 div id=pagetitle class=TEST FOLDER!!!/div

 The objective is to set the page title to #pagetitle('s) class attribute's
 value - the node has no text and is delivered at the beginning of each new
 page brought in through a .load ajax method

 The function seems to only fire on the initial page load -- not using .load
  -- so when the new instance of pagetitle is brought in by .load livequery
 doesn't seem to nortice.

 Thanks in advance for looking this over I've also posted the highlighted
 code at -http://www.pastie.org/187268

 #

 $(document).ready(function() {

 $(#pagetitle)
 .livequery(function() {
 //alert($(this).attr(class));
 $(title).text($(this).attr(class));
 return false;

 });

 $(.main_link)
 .livequery(click, function(){
 $.cntx = $(this).text().toLowerCase();
 $.div = ' #container';
 $.url = 'http://localhost:8080/test/'+ $.cntx + $.div;
 $(.body_content).load($.url);
 return false;
 });

 $(#container a)
 .livequery(click, function(){
 $.div = ' #container';
 $.url = $(this).attr('href') + $.div;
 $(.body_content).load($.url);
 //alert($.url);
 return false;
 });

 });


[jQuery] Re: Livequery not binding on div after a .load method

2008-04-27 Thread Brandon Aaron

LiveQuery has two types of queries: event and function. A function
based LiveQuery fires a given function when an element is added to the
DOM and another function, if given, for when an element is removed
from the dom. The function based LiveQuery is not attached to a
particular event. The docs are here: http://docs.jquery.com/Plugins/livequery

--
Brandon Aaron

On Apr 26, 4:12 pm, Alexandre Plennevaux [EMAIL PROTECTED]
wrote:
 correct me if i'm wrong but i think livequery needs to know on which event
 type it should be attached to:

 so something like this  _

 $(#pagetitle)
 .livequery('load',function() {
  //alert($(this).attr(class));
 $(title).text($(this).attr(class));
 return false;
  });

 see the doc for more info:http://brandonaaron.net/docs/livequery/


[jQuery] Correct viewport height?

2008-04-27 Thread HertzaHaeon

When I use $(window).height() with Dimensions 1.2, it doesn't give me
the height of the viewable part of the document. Instead I get the
same number as for $(document).height(), i.e. the total height of
everything in the document, including off-screen parts.

Is this a bug or am I using it wrong? I get the same behavior on
Firefox 2 and IE7. How do I get the height of the visible part of the
document with jQuery?


[jQuery] Re: Correct viewport height?

2008-04-27 Thread Brandon Aaron
Which version of jQuery are you using? Dimensions 1.2 no longer has the
width/height methods as they have been moved to the core. This sounds like a
familiar issue in jQuery 1.2.1/2 but was fixed in jQuery 1.2.3.

--
Brandon Aaron

On Sun, Apr 27, 2008 at 1:06 PM, HertzaHaeon [EMAIL PROTECTED] wrote:


 When I use $(window).height() with Dimensions 1.2, it doesn't give me
 the height of the viewable part of the document. Instead I get the
 same number as for $(document).height(), i.e. the total height of
 everything in the document, including off-screen parts.

 Is this a bug or am I using it wrong? I get the same behavior on
 Firefox 2 and IE7. How do I get the height of the visible part of the
 document with jQuery?



[jQuery] [ANNOUNCE] New Twitter Account for jQuery jQuery UI Projects

2008-04-27 Thread Rey Bango


In an effort to maximize the reach of announcements about upcoming 
jQuery  jQuery UI updates and releases, the team has created a new 
Twitter account:


http://twitter.com/jquery

and

http://twitter.com/jqueryui

I urge you to follow the accounts, along with the mailing list, for 
updates and news.


Please note that we may not follow all accounts and will be using this 
primarily as a notification tool.


Rey
jQuery Project Team


[jQuery] Re: Livequery not binding on div after a .load method

2008-04-27 Thread minskmaz

Brandon - I solved my problem *temporarily* by using the callback
function on ajaxComplete - however I have still not been able to
simply define an event subscriber that rebinds to the 'a' tags inside
of my newly .load(ed) container div. As Alexandre pointed out it's
unclear whether I should be binding to the load event or the clicking
of an 'a' tag. Is it possible to register two subscribers to the same
event ? See code below.

$(document).ready(function() {
$(a)
.livequery(click, function(){
//insert a url filter here so we don't load external pages
the div
$div = ' #container';
$url = $(this).attr('href') + $div;
$title = $(this).attr('title');
$(.body_content_l).load($url).ajaxComplete($
(document.title = $(this).attr(title)));
return false;
});
});



On Apr 27, 11:15 am, Brandon Aaron [EMAIL PROTECTED] wrote:
 Post up an example so that we can see where LiveQuery is breaking for
 you.

 --
 Brandon Aaron

 On Apr 27, 8:19 am, Sid [EMAIL PROTECTED] wrote:

  I face the same problem.
  New classes are simply not recognized, making my links disfunctional.


[jQuery] Re: Correct viewport height?

2008-04-27 Thread HertzaHaeon

Updating to jQuery 1.2.3 solved the problem. Thank you!


[jQuery] Release: Autocomplete Plugin 1.0

2008-04-27 Thread Jörn Zaefferer


Hi,

I've just finished the 1.0 release of my autocomplete plugin. Details on 
the blog: http://bassistance.de/2008/04/27/release-autocomplete-plugin-10/


And some direct links to get started:
Plugin page: 
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

Demos: http://jquery.bassistance.de/autocomplete/demo/
Documentation: http://docs.jquery.com/Plugins/Autocomplete

Have fun!

Jörn Zaefferer


[jQuery] Re: [validate] RFC: buttons and cancel class

2008-04-27 Thread Jörn Zaefferer


Karan Sev schrieb:

Hi,
I have button (type: submit) with the class 'cancel' but this still
results in the form being validated. It works if I change the button
to an input.
After

// allow suppresing validation by adding a cancel class to the submit
button
this.find(input.cancel:submit).click(function() {
validator.cancelSubmit = true;
});

To fix this on line 42 I added,

// allow suppresing validation by adding a cancel class to the submit
button
this.find(button.cancel:submit).click(function() {
validator.cancelSubmit = true;
});

I know this might be on a tangent, but was this just a simple omission
or are button evils and I should stick with inputs?
  
This was just an ommision. How about just .cancel:submit as the 
selector? That would match both inputs and buttons.


Jörn


[jQuery] jQuery Lightbox problem

2008-04-27 Thread kirstyburgoine

Hi,
I've been using this great jQuery lightbox plugin for a variety of
things and its always worked really well.  Recently I've tried adding
into my own blog site I'm building using Wordpress and now I get an
error.

I put this into header.php:

script type=text/javascript src=http://
www.postcardsfromtheborder.co.uk/wordpress/wp-content/themes/postcards/js/jquery.js/script

script type=text/javascript src=http://
www.postcardsfromtheborder.co.uk/wordpress/wp-content/themes/postcards/js/jquery.lightbox-0.5.js/script

link rel=stylesheet type=text/css href=css/
jquery.lightbox-0.5.css media=screen /

script type=text/javascript
$(document).ready(function() {
$('#gallery a').lightBox();
});
/script
style type=text/css
/* jQuery lightBox plugin - Gallery style */
#gallery {
background-color: #444;
padding: 10px;
width: 520px;
}
ul#gallery  {
background-color: #444;
padding: 10px;
width: 520px;
list-style: none;
overflow: scroll;
 }
 ul#gallery li { display: inline;

}
#gallery ul img {
border: 5px solid #3e3e3e;
border-width: 5px 5px 20px;
}

ul#gallery li a {
display:inline;
}
ul#gallery a:hover img {
border: 5px solid #fff;
border-width: 5px 5px 20px;
color: #fff;
}
ul#gallery a:hover { color: #fff; }
/style

and then in wordpress when I write a post I view it in code view and
add the id=gallery to the ul that is listing my images. But it
doesn't work. When I debug using the firefox extension firebug I get
the error
$(#gallery a) has no properties.

I thought that maybe my header couldn't see jquery.lightbox-0.5.js so
I changed the path to an absolute path. Also, originally my images
were contained in a div called gallery but wordpress seemed to
ignore my div tags in posts so I changed it so that ul had the id
of gallery instead. Nothing seems to have worked.

I don't get why I'm having this problem with this plugin using
Wordpress when I've done nothing different from other sites I've used
it on. Its not as if I've mistaken it for a Wordpress plugin and tryed
to install it into Wordpress rather than my code or anything silly
like that.

You can view the grey box that should be my gallery here:
http://www.postcardsfromtheborder.co.uk/wordpress/

Somebody please tell me what I've missed.

Thanks
Kirsty


[jQuery] Re: How to bind to multiple elements

2008-04-27 Thread LostCore

Thanks for all the advices! It was a very newbie error :P

Can i ask another little question?

Starts with this code (a new version of what i posted early)


$(.imagencap).bind(click, function(){
if($(this).children().is(textarea)){ return; } //return if
textarea is already created
var myP = $(this).find(p);
var myCaption = myP.text();
var myId = myP.attr(id);
//alert(myId+: +myCaption);
var textarea = textarea id=+myId+ cols='9' 
rows='9'+myCaption
+/textarea;
var buttons = span class='savencancel'[a 
href='#save'SAVE/a]
[a href='#cancel'CANCEL/a]/span;
myP.hide();
myP.before(br /br /+textarea++buttons);

$(this).find(span).find(a).bind(click, function(e){
e.preventDefault();
if($(this).attr(href) == #save){
//alert(salvo!);
}
if($(this).attr(href) == #cancel){
//alert(cancello!);
$(this).parent().hide(slow);
$
(this).parents(.imagencap).children(textarea).hide(slow);

//$(this).parents(.imagencap).children(textarea).remove();
$(this).parents(.imagencap).find(p).show();

}
});
});


Well, this code put a SAVE and a CANCEL links at the bottom of the
textarea (for each images). When i click CANCEL i would to do that
textarea and button hides and the p came back.

In code i've posted, when i click on these links the click event
propagate to the imagencaption class, so:
- if i hide the textarea, i can't do any change anymore (the check at
the first line returns true).
- if i remove the textarea, a new textarea appears (because the check
at the first line fails).

Any idea? Thanks!

On 27 Apr, 19:13, steve_f [EMAIL PROTECTED] wrote:
 Do you have multiple divs with the same id of 'images'?. if so you
 need to start using class name selectors, then you can iterate all the
 divs with that clas name e.g
  $(.images).each

 On Apr 27, 11:25 am, LostCore [EMAIL PROTECTED] wrote:

  Hi!

  Well, i'll quickly describe my problem.

  In a page, i've multiple occurrence of:

  [code]
  div id=images
  div id=imagencap style=float:left;
  img src=fileName.jpg /
  p id=caption_id
  caption_text
  /p
  /div
  /div
  [/code]

  I would do, that when i click on a caption_text, the relative
  paragraph tag hide, and a textarea appears, with the text of the p.

  Then, i've scripted this:

  [code]
  $(#images).find(#imagencap)
  .click(function(e){

  if($(this).children().is(textarea)){ return; }

  var myP = $(this).find(p);
  var myCaption = myP.text();
  var myId = myP.attr(id);

  var textarea = textarea 
  id=+myId++myCaption+/textarea;
  var buttons = [a href='#'SAVE/a] [a 
  href='#'CANCEL/a];
  myP.hide();
  myP.before(br /+textarea+br /+buttons);
  });
  [/code]

  ... That works!. But only for the first occurrence!

  Where is the problem?

  Thanks :)


[jQuery] Re: function from an external js does is not defined when using $(document).ready in the external file

2008-04-27 Thread Karl Rudd

var say_something;

$(document).ready(function(){
  say_something = function(word){
alert(word);
  }
});

Karl Rudd

On Mon, Apr 28, 2008 at 6:01 AM, Yuval [EMAIL PROTECTED] wrote:

  Hey Mike,
  Thanks a lot for your explanation!
  Say I insisted on defining it within the $(document).ready function,
  how would I access a function that is located inside another function?
  Thank you,
  Yuval

  On Apr 27, 12:37 am, Michael Geary [EMAIL PROTECTED] wrote:
   Hi Yuval,
  
   It looks like you've solved the problem, and your solution is correct.
  
   The reason you didn't find any jQuery-specific information about this is
   that it isn't a jQuery problem at all. It's a matter of JavaScript scoping.
  
   Your say_something function is defined inside another function, therefore
   the name say_something is local to that outer function and not available
   outside it.
  
   You'd have exactly the same problem if settings.js looked like this:
  
   function foobar() {
   function say_something(word){
   alert(word);
   }
  
   }
  
   There is no need for your say_something() definition to be located inside a
   $(document).ready() callback function. By defining it directly at the top
   level (not inside another function), you make it available globally, which
   is just what you need:
  
   function say_something(word){
   alert(word);
  
   }
  
   -Mike
  
From: Yuval
  
Hey Guys,
I have 2 files. index.html and settings.js
  
inside settings.js:
  
$(document).ready(function(){
function say_something(word){
   alert(word);
}
})
  
inside index.html
  
script language=javascript
$(document).ready(function(){
say_something(hello);
});
/script
  
I am using Firefox 2 with Firebug and it claims the function
is not defined. The code does not work.
So why is this a jQuery problem, you ask?
Well, if I remove the $(document).ready call from the
external file, everything works fine!
  
this is what it looks like when it works:
  
inside settings.js:
  
//  no $(document).ready call
function say_something(word){
   alert(word);
}
  
inside index.html
  
script language=javascript
$(document).ready(function(){
say_something(hello);
});
/script
  
I've been searching Google and the forum for almost 2 hours
now with no answer to why this does not work with
$(document).ready. Any ideas?
Thank you,
Yuval
  
p.s. replacing script language=javascript with  script
language=text/javascript simply suppresses the error, it
does not solve the problem.



[jQuery] [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread s.ross

I just posted a couple of plugins in a git repo at:

git://github.com/sxross/jquery_plugins.git

To grab them, just:

git-clone git://github.com/sxross/jquery_plugins.git

They are focusFirstInput and ajaxLinkBind. You can read about the at:

http://calicowebdev/blog/show/20

In a nutshell, they do this:

== focusFirstInput ==

Just sets the focus to the first input field on a form, if there is a
form or an input. How many times have you written that code? No, it's
not YAGNI, but it may be useful :)

== ajaxLinkBind ==

More specialized, it is set up to hijack links inside a container and
turn them into Ajaxified links to Rails controllers. Atypically,
instead of using XML, this plugin uses JSON. If Javascript is turned
off in the browser, the links (surprise) revert to normal HTML links
and issue a GET to the Rails controller.

Comments welcome!


[jQuery] Re: function from an external js does is not defined when using $(document).ready in the external file

2008-04-27 Thread Klaus Hartl

Or:

$(function() {
window.say_something = function(word) {
alert(word);
};
});

--Klaus

On Apr 27, 11:24 pm, Karl Rudd [EMAIL PROTECTED] wrote:
 var say_something;

 $(document).ready(function(){
   say_something = function(word){
     alert(word);
   }

 });

 Karl Rudd

 On Mon, Apr 28, 2008 at 6:01 AM, Yuval [EMAIL PROTECTED] wrote:

   Hey Mike,
   Thanks a lot for your explanation!
   Say I insisted on defining it within the $(document).ready function,
   how would I access a function that is located inside another function?
   Thank you,
   Yuval

   On Apr 27, 12:37 am, Michael Geary [EMAIL PROTECTED] wrote:
    Hi Yuval,

    It looks like you've solved the problem, and your solution is correct.

    The reason you didn't find any jQuery-specific information about this is
    that it isn't a jQuery problem at all. It's a matter of JavaScript 
  scoping.

    Your say_something function is defined inside another function, therefore
    the name say_something is local to that outer function and not 
  available
    outside it.

    You'd have exactly the same problem if settings.js looked like this:

    function foobar() {
        function say_something(word){
            alert(word);
        }

    }

    There is no need for your say_something() definition to be located 
  inside a
    $(document).ready() callback function. By defining it directly at the top
    level (not inside another function), you make it available globally, 
  which
    is just what you need:

    function say_something(word){
        alert(word);

    }

    -Mike

     From: Yuval

     Hey Guys,
     I have 2 files. index.html and settings.js

     inside settings.js:

     $(document).ready(function(){
     function say_something(word){
        alert(word);
     }
     })

     inside index.html

     script language=javascript
     $(document).ready(function(){
     say_something(hello);
     });
     /script

     I am using Firefox 2 with Firebug and it claims the function
     is not defined. The code does not work.
     So why is this a jQuery problem, you ask?
     Well, if I remove the $(document).ready call from the
     external file, everything works fine!

     this is what it looks like when it works:

     inside settings.js:

     //  no $(document).ready call
     function say_something(word){
        alert(word);
     }

     inside index.html

     script language=javascript
     $(document).ready(function(){
     say_something(hello);
     });
     /script

     I've been searching Google and the forum for almost 2 hours
     now with no answer to why this does not work with
     $(document).ready. Any ideas?
     Thank you,
     Yuval

     p.s. replacing script language=javascript with  script
     language=text/javascript simply suppresses the error, it
     does not solve the problem.


[jQuery] Re: Cycle (fx:'custom' )

2008-04-27 Thread Eddie

Hi Mike!
I've just solved the problem, it was a parsing error due to a comma in
front of the last option as in the exemple below:
$(#thumbnails).cycle({
fx:'dvThNails',
timeout:0,
pager:ul.nav,
pagerAnchorBuilder: function(idx, slide){
return 'ul.nav li:eq(' + (idx) + ') a';
}, // this extra comma was removed and the problem solved in
IE6/7 and Safari (Sorry, my bad!)
});
Here is the test page link: http://eddielt.hyperphp.com/3d.html
Thank you for your response, btw, great, great plugin!!!

On 27 abr, 11:19, Mike Alsup [EMAIL PROTECTED] wrote:
   Hails! I've been having a trouble with a custom effect on IE and
   Safari, but it works perfectly on Firefox, although Firebug shows the
   following message: [cycle] unknown transition: custom. It's not a
   error message, but I believe it has something to do with the bug in IE
   and Safari. Then, I tried turning the custom effect into a transition
   definition as the described in the Cycle documention (http://
   www.malsup.com/jquery/cycle/adv2.html) and now it works in the same
   way on Firefox, but without that message on Firebug.

 Hi Eddie,

 The log message you see is confusing and I'll fix that.  But you
 haven't provided enough information for me to help with the real
 problem.   Can you post a link?

 Mike


[jQuery] calling a function before a form is submitted

2008-04-27 Thread gregarious

Hi,

I'm trying to perform an action before a form is submitted using the
following snippet:

$('form').submit(function() {
updateMapFromFields();
return true;
});

but for some reasons the updateMapFromFields seems not to be executed.
If, instead, I execute the following code (with return false at the
end):

$('form').submit(function() {
updateMapFromFields();
return false;
});

I can see that the updateMapFromFields() works fine but, obviously,
the form isn't submitted (while I'd like it to be submitted somehow).
Am I supposed to do something else in order to perform an action
before the form is submitted?

Thanks a lot for your time, any help would be very appreciated.

Regards
Francesco


[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread Jörn Zaefferer


s.ross schrieb:

Comments welcome!
  
Please provide something else then just a git link, eg. a simple 
download. Its fine that you use git as your source control system, but 
please don't assume everyone else does, too.


Jörn



[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread s.ross


The files are available -- without git -- on github. If you don't want  
to clone them, just browse to them and download what you want.


http://github.com/sxross/jquery_plugins/tree/master

Does that work ok?


On Apr 27, 2008, at 3:56 PM, Jörn Zaefferer wrote:



s.ross schrieb:

Comments welcome!

Please provide something else then just a git link, eg. a simple  
download. Its fine that you use git as your source control system,  
but please don't assume everyone else does, too.


Jörn





[jQuery] Re: calling a function before a form is submitted

2008-04-27 Thread Michael Geary

Francesco,

As you know, JavaScript executes statements sequentially one after another,
so it isn't generally possible for one line of code to affect another line
of code that's already been executed.

There are two exceptions that I'm aware of:

1) A syntax error will prevent *any* of your code from being executed. But
Firebug will display the error if that's the case.

2) If your DeLorean hits that wire with the connecting hook at precisely
88mph the instant the lightning strikes the tower, all bets are off. Neither
JavaScript nor Firebug can keep up with a speeding DeLorean.

But it doesn't appear that either is the case here. If the only difference
between the two examples is the return true vs. return false, then they
should both be executing the updateMapFromFields() call, or neither one is.
If one is and one isn't, then there must be some other difference between
your two test cases.

Maybe updateMapFromFields() actually is being executed in both cases, but
something is going wrong in the function so it doesn't seem to have the
expected result? Have you put a console.log() call at the beginning of that
function to see if Firebug logs the call?

Rather than speculate on what might be going wrong, how about posting a link
to a test page that demonstrates the problem?

-Mike

 From: gregarious
 
 Hi,
 
 I'm trying to perform an action before a form is submitted 
 using the following snippet:
 
 $('form').submit(function() {
 updateMapFromFields();
 return true;
 });
 
 but for some reasons the updateMapFromFields seems not to be executed.
 If, instead, I execute the following code (with return false at the
 end):
 
 $('form').submit(function() {
 updateMapFromFields();
 return false;
 });
 
 I can see that the updateMapFromFields() works fine but, 
 obviously, the form isn't submitted (while I'd like it to be 
 submitted somehow).
 Am I supposed to do something else in order to perform an 
 action before the form is submitted?
 
 Thanks a lot for your time, any help would be very appreciated.



[jQuery] Re: using jQuery with Struts framework

2008-04-27 Thread RecursiveBrain

Hey -

I believe you can use the styleID attritbute of the struts
html:select/html:select tag. It will render as id after the page
is compiled and loaded.

Hope that helps!!

On Apr 14, 6:17 am, hero789 [EMAIL PROTECTED] wrote:
 Hi every Body :
  I 'm a java developer and i find that the jQuery  is an amazing
 javascript library and very powerful
 but i have a  noticed that in selecting  controls you  select usint
 the  id  tag
 but i struts framework we don't use id tag instead we use property
 tag  if struts  forms ;
 so i want  to use the  date-time picker on struts form but i don't
 know how since i have no id  tag
 please help me if  any  body has a solution for this .

 thanks ;


[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread Mike Alsup

  Comments welcome!

I'd recommend not using global vars.  Both of those plugins are doing so.


[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread Scott Trudeau
To be a little more specific, for example, do this:

var e = $('form input:visible');

Not:

e = $('form input:visible')


On Sun, Apr 27, 2008 at 8:11 PM, Mike Alsup [EMAIL PROTECTED] wrote:


   Comments welcome!

 I'd recommend not using global vars.  Both of those plugins are doing so.




-- 
--
Scott Trudeau
scott.trudeau AT gmail DOT com
http://sstrudeau.com/
AIM: sodthestreets


[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread s.ross

Righto. Also, there might be some benefit in wrapping w/

(function($) {
  // stuff
})(jQuery);

Yes?

I have a couple of extend's to do that will make things work much more  
nicely.


Thx for the comments.


On Apr 27, 2008, at 5:23 PM, Scott Trudeau wrote:



To be a little more specific, for example, do this:
var e = $('form input:visible');
Not:
e = $('form input:visible')

On Sun, Apr 27, 2008 at 8:11 PM, Mike Alsup [EMAIL PROTECTED] wrote:

  Comments welcome!

I'd recommend not using global vars.  Both of those plugins are  
doing so.




--
--
Scott Trudeau
scott.trudeau AT gmail DOT com
http://sstrudeau.com/
AIM: sodthestreets




[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins

2008-04-27 Thread Scott Trudeau
Yes.  That creates a single scope for all the plugin code and allows you to
use $() inside that scope.  Handy when the next user comes along that
doesn't use the $() alias for jQuery() (e.g., because they also use
Prototype or another library), while keeping the plugin code tight.

Scott

On Sun, Apr 27, 2008 at 8:25 PM, s.ross [EMAIL PROTECTED] wrote:

 Righto. Also, there might be some benefit in wrapping w/
 (function($) {
   // stuff
 })(jQuery);

 Yes?

 I have a couple of extend's to do that will make things work much more
 nicely.

 Thx for the comments.


 On Apr 27, 2008, at 5:23 PM, Scott Trudeau wrote:


 To be a little more specific, for example, do this:

 var e = $('form input:visible');

 Not:

 e = $('form input:visible')


 On Sun, Apr 27, 2008 at 8:11 PM, Mike Alsup [EMAIL PROTECTED] wrote:

 
Comments welcome!
 
  I'd recommend not using global vars.  Both of those plugins are doing
  so.
 



 --
 --
 Scott Trudeau
 scott.trudeau AT gmail DOT com
 http://sstrudeau.com/
 AIM: sodthestreets





-- 
--
Scott Trudeau
scott.trudeau AT gmail DOT com
http://sstrudeau.com/
AIM: sodthestreets


[jQuery] unsubscribe

2008-04-27 Thread Glen Hinkle




[jQuery] Re: jQuery Lightbox problem

2008-04-27 Thread ripple
First thing I notice is that your image path is broken.
   
  Try fixing that 1st and maybe everything else will work out.
   
  

kirstyburgoine [EMAIL PROTECTED] wrote:
  
Hi,
I've been using this great jQuery lightbox plugin for a variety of
things and its always worked really well. Recently I've tried adding
into my own blog site I'm building using Wordpress and now I get an
error.

I put this into header.php:

  
www.postcardsfromtheborder.co.uk/wordpress/wp-content/themes/postcards/js/jquery.js
 type=text/javascript  

  
www.postcardsfromtheborder.co.uk/wordpress/wp-content/themes/postcards/js/jquery.lightbox-0.5.js
 type=text/javascript  


jquery.lightbox-0.5.css type=text/css rel=stylesheet

  
 $(document).ready(function() {
 $('#gallery a').lightBox();
 });
  
  
 /* jQuery lightBox plugin - Gallery style */
 #gallery {
  background-color: #444;
  padding: 10px;
  width: 520px;
 }
 ul#gallery  {
  background-color: #444;
  padding: 10px;
  width: 520px;
  list-style: none;
  overflow: scroll;
  }
  ul#gallery li { display: inline;

 }
 #gallery ul img {
  border: 5px solid #3e3e3e;
  border-width: 5px 5px 20px;
 }

 ul#gallery li a {
  display:inline;
 }
 ul#gallery a:hover img {
  border: 5px solid #fff;
  border-width: 5px 5px 20px;
  color: #fff;
 }
 ul#gallery a:hover { color: #fff; }
   

and then in wordpress when I write a post I view it in code view and
add the id=gallery to the   that is listing my images. But it
doesn't work. When I debug using the firefox extension firebug I get
the error
$(#gallery a) has no properties.

I thought that maybe my header couldn't see jquery.lightbox-0.5.js so
I changed the path to an absolute path. Also, originally my images
were contained in a   called gallery but wordpress seemed to
ignore my   tags in posts so I changed it so that   had the id
of gallery instead. Nothing seems to have worked.

I don't get why I'm having this problem with this plugin using
Wordpress when I've done nothing different from other sites I've used
it on. Its not as if I've mistaken it for a Wordpress plugin and tryed
to install it into Wordpress rather than my code or anything silly
like that.

You can view the grey box that should be my gallery here:
http://www.postcardsfromtheborder.co.uk/wordpress/

Somebody please tell me what I've missed.

Thanks
Kirsty






   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[jQuery] Re: jQuery Lightbox problem

2008-04-27 Thread Sam Sherlock
i think that for some reason selectors are not functioning

always return null afais.

try using others browsers after fixing the path.

the html looks ok to me but ther is a comment before the open of html tag

hth - S

2008/4/28 ripple [EMAIL PROTECTED]:

 First thing I notice is that your image path is broken.

 Try fixing that 1st and maybe everything else will work out.



 *kirstyburgoine [EMAIL PROTECTED]* wrote:


 Hi,
 I've been using this great jQuery lightbox plugin for a variety of
 things and its always worked really well. Recently I've tried adding
 into my own blog site I'm building using Wordpress and now I get an
 error.

 I put this into header.php:










 and then in wordpress when I write a post I view it in code view and
 add the id=gallery to the

that is listing my images. But it
doesn't work. When I debug using the firefox extension firebug I get
the error
$(#gallery a) has no properties.

I thought that maybe my header couldn't see jquery.lightbox-0.5.js
so
I changed the path to an absolute path. Also, originally my images
were contained in a
called gallery but wordpress seemed to
ignore my
tags in posts so I changed it so that
had the id
   of gallery instead. Nothing seems to have worked.

   I don't get why I'm having this problem with this plugin using
   Wordpress when I've done nothing different from other sites
   I've used
   it on. Its not as if I've mistaken it for a Wordpress plugin
   and tryed
   to install it into Wordpress rather than my code or anything
   silly
   like that.

   You can view the grey box that should be my gallery here:
   http://www.postcardsfromtheborder.co.uk/wordpress/

   Somebody please tell me what I've missed.

   Thanks
   Kirsty


 --
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
 now.http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ