[jQuery] Re: Nesting toddle div's

2008-11-16 Thread sinkingfish


That's great, thanks Richard. Thanks for the explanation too, really helped
to show me where i was going wrong.

Brian


Richard D. Worth-2 wrote:
 
 This should work:
 
 $(div.togglecontainer div.togglebutton).click(function() {
 $(this).siblings(div.toggletarget).slideToggle();
 });
 $('div.toggletarget').hide();
 
 A couple of notes:
 
 - I combined your first two selectors into one
 - I've used .click(fn) in place of .bind(click, fn)
 - No need for .each as .click will automatically do .each inside it
 - I first changed your .parent().find(div.toggletarget) to
 .parent().children(div.toggletarget) - this was your biggest issue
 - I then substituted .siblings for .parent().children(div.toggletarget)
 - No need to compare event.target, nor return false, since you are binding
 to elements with no descendants
 
 - Richard
 
 On Fri, Nov 14, 2008 at 12:34 PM, sinkingfish [EMAIL PROTECTED]
 wrote:
 


 Thanks for the reply Richard, unfortunately that wasn't the issue. Ive
 tided
 up my example to make it clearer :  http://pastie.org/314976
 http://pastie.org/314976

 So at startup you should see 'Click me' then upon clicking, 'I'm Hidden'
 
 'Click ME To see more' will be revealed. After clicking 'Click ME To see
 more', 'Nested Hidden' would be revealed.

 Thanks for the help



 Richard D. Worth-2 wrote:
 
  You may want to start by validating your html. You're missing a closing
  /div, so it's not clear how you intend it to be nested. Once you've
  corrected that, let us know if you still have a problem.
 
  - Richard
 
  On Fri, Nov 14, 2008 at 10:26 AM, sinkingfish [EMAIL PROTECTED]
  wrote:
 
 
 
  Hi,
 
  Im new to jQuery and looking for a bit of help. Im trying to have
  toggleable
  content within toggleable content.
 
 
  http://pastie.org/314861 Code
 
 
  It's just not working for me, when I click the first toggle all is
  revealed?
  Am I way off? Something to do with propagation?
 
  Thanks
  Brian
  --
  View this message in context:
 
 http://www.nabble.com/Nesting-toddle-div%27s-tp20502521s27240p20502521.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Nesting-toggle-div%27s-tp20502521s27240p20505081.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 

-- 
View this message in context: 
http://www.nabble.com/Nesting-toggle-div%27s-tp20502521s27240p20523483.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Validate. Can I validate using 2 values?

2008-11-16 Thread Jörn Zaefferer
I mean

$().ajaxSend(function() {

});

Jörn

On Sun, Nov 16, 2008 at 1:24 AM, shapper [EMAIL PROTECTED] wrote:

 Hi Jorn,

 You mean using:

  $.ajax({
   beforeSend: function(){
   }
  });

 And in before send get the value of the text box and add it to the
 ajax validate request of the validate?

 But how can I link it to the Validate email validation?

 Thanks,
 Miguel

 On Nov 15, 2:21 pm, Alexsandro_xpt [EMAIL PROTECTED] wrote:
 And about form submit before to validate e-mail field?

 Do you know something about that?

 Thanks
 Alexsandro

 On 13 nov, 14:00, Jörn Zaefferer [EMAIL PROTECTED]
 wrote:

  The plugin doesn't support that. As a workaround, you can use jQuery's
  ajaxSend callback to add additional data to the 
  request:http://docs.jquery.com/Ajax/ajaxSend#callback

  Jörn

  On Thu, Nov 13, 2008 at 3:35 PM, shapper [EMAIL PROTECTED] wrote:

   Hello,

   I am using the following to validate an email field:

   Email: { email: true, remote: /Account/FindEmail, required: true }

   I am checking if there is already an account with that email.

   In my form I also have an input where the user inserts its username.
   When validating the email I need to send also the Username an not only
   the email.

   Can I do this?

   Thanks,
   Miguel


[jQuery] Destroying parent tag when restoring original value.

2008-11-16 Thread Rage9

Having a heck of a time figuring this out, I have made a few fields
(td'seditable, so when you click on them it puts in a form with a
text box and a button to submit, and a button to undo it.

Well when I undo it, everything looks fine but the data is trapped in
another set of td tags.  Is their anyway to kill off these extra
td's, because this can keep happening every time someone clicks on
it and undoes it.

Code:

function setClickableTitle(obj, i) {
$(obj).click(function() {
 var account = $(obj).attr('accountno');
 var id = $(obj).attr('id');
 var title = $(obj).attr('title');
 var revert = $(obj).html();
 var test = code that goes into the td just clicked;
  $(obj).after(test).remove();
  $('.titleClose').click(function(){stepBackTitle(this, revert, i,
id, title, account);});
});


function stepBackTitle(obj, revert, n, id, title, account) {
$(obj).parent().replaceWith(td id=' + id + ' title=' + title +
' accountno=' + account + ' + revert + /td);
setClickableTitle($(td[title]).get(n), n);
};
}


[jQuery] Do DOM generated links treat their containers differently then hard coded?

2008-11-16 Thread Majorchamp

I have this test page up: http://btk.name/misc/links.html

Basically, I am using Jquery and a Cycle plugin to allow the user to
paginate via links through content. Simple enough.

However, as you can see (at least in Firefox 3), the DOM generated
links (via the plugin) keep going in 1 line outside the container.

The links hardcoded into the actual HTML adhere to their container.

Why would JavaScript generated links be treated different? I just want
them to wrap appropriately.

Thanks


[jQuery] delayed tooltip hiding

2008-11-16 Thread martin

I'm trying to implement my own tooltip plugin with an optional delayed
hiding on mouseout event. This wouldn't be a problem if the tooltip
wasn't displaying so frequently a need it to. I want to use it in a
chat room where messages are starting with users' nicks which are
links and on mouseover event the tooltip should display.
It looks like this:

nick: some message
othernick: some other message
nicknick: some nicknick's message
...

on `mouseovering` the 'nick' link, the tooltip displays and on
mouseout it delays a certain time and then hides itself. everything's
ok so far.
The problem appears in the moment when I quickly switch between two
links (I'm over 'nick' and will roll the mouse quickly over
'othernick'). The timeout delaying the tooltip hiding didn't run out
yet, I'm over other link and I want the timeout to be cleared to not
to hide the tooltip which should remain displayed.

Below is a fragment of my plugin's code. It contains only relevant
code, to show transparently the situation (it uses dimensions plugin:
http://plugins.jquery.com/project/dimensions). This is my first jQuery
plugin, but technically I think this is how it should work (and the
problem is probably in clearing the timeout, not in plugin structure).
So if you got any ideas, post it please. Thank you guys.

Here is the code:

(function($) {

  var $straytip, $straytipInner;
  var hideTimerId = 0;
  var isActive = false;
  // plugin
  $.fn.straytip = function(options) {
//setting main options
var opts = $.extend({}, $.fn.straytip.defaults, options);

//iterating all matched elements
return this.each(function() {
  $this = $(this);

  //if there are any specific options set it
  var o = $.meta ? $.extend({}, opts, $this.data()) : opts;

  //creation of tooltips div
  if (!$(#straytip).length){
$straytipInner = $('div id=straytipInner/div');
$straytip = $('div id=straytip/div')
  .css({zIndex: o.zIndex, position: absolute})
  [insertionMethod](insertionElement)//specified in setup
  .hide();
  }

  //processing the hover effect
  $this.hover(
function(){$.fn.straytip.over($(this), o)},
function(){$.fn.straytip.out($(this), o)}
  );
});
  };

  $.fn.straytip.over = function($this, opts) {
if (hideTimerId  0){//HERE IS WHERE IT SHOULD CLEAR THE TIMEOUT
WHICH DELAYS HIDING
  $straytip.hide();
  isActive = false;
  clearTimeout(hideTimerId);
  hideTimerId = 0;
}
var offset = $this.offset();
var height = $this.height();
var width = $this.width();
$straytip.css({top: offset.top + height + opts.topOffset, left:
offset.left + width + opts.leftOffset});
$straytip.show();
isActive = true;
  };

  $.fn.straytip.out = function($this, opts) {
if (opts.delayHide  0){//delayed hiding
  hideTimerId = setTimeout(
function(){
  $straytip.hide();
  isActive = false;
  hideTimerId = 0;
},
opts.delayHide
  );
} else {
  $straytip.hide();
  isActive = false;
}
  };


  $.fn.straytip.defaults = {
topOffset: 15,
leftOffset: 15,

delayHide: 0,

zIndex: 100
  };

  //setup
  var insertionMethod = 'prependTo', insertionElement = 'body';
  $.straytip = {};
  $.straytip.setup = function(options) {
if (options  options.insertionMethod 
(options.insertionMethod).match(/appendTo|prependTo|insertBefore|
insertAfter/)) {
  insertionMethod = options.insertionMethod;
}
if (options  options.insertionElement) {
  insertionElement = options.insertionElement;
}
  };

})(jQuery);


[jQuery] Re: How to pass arguments from link to ajax function

2008-11-16 Thread balavignesh


Hi leap !

I want to pass arguments from link to jquery function , like
follow

 $(#view).click(function(){
...
...logic to send the values using jquery ajax...
...
});

  Any suggestion , ...

Regards,
Balavignesh



[jQuery] non-programmer

2008-11-16 Thread ncriptide

I've been a graphic designer for the past 25 years. Only programming
I know is HTML and a little CSS. I'm about to try my hand at learning
JavaScript and AJAX . . . . should I learn JavaScript first - and then
learn JQuery, or will I be okay just diving into JQuery?

Just to let you know - being a designer and working off that side of
my brain - I have to tell you - even the most simple programming
concepts come hard to me. The books, For Dummies are over my
head. . . I tried learning PHP/MySQL . . . had to put it aside for
now. Just can't wrap my brain around it.

With that said, I am dogged determined to learn all the above, but
figure I need JavaScript first. What do you recommend? Dive into
JQuery?


[jQuery] SerialScroll won't scroll

2008-11-16 Thread patrick91

Hi I've this markup: http://dpaste.com/91124/

and this js (from init.js): http://dpaste.com/91126/

with firebug i get no errors but when I click on the a the div won't
scroll :(

can you help me?


[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread flycast

That does not work. This is what I have:

function confSubmit(form) {
if (confirm(Are you sure you want to submit the form?)) {
   $(#employmentForm).submit();
}else{
   return false;
}

}//End of confSubmit function

The form validates and submits anyway. Notice in the title I indicate
that I am using Validate plugin,


[jQuery] Re: Do DOM generated links treat their containers differently then hard coded?

2008-11-16 Thread Mike Alsup

 I have this test page up:http://btk.name/misc/links.html

 Basically, I am using Jquery and a Cycle plugin to allow the user to
 paginate via links through content. Simple enough.

 However, as you can see (at least in Firefox 3), the DOM generated
 links (via the plugin) keep going in 1 line outside the container.

 The links hardcoded into the actual HTML adhere to their container.


The differences you see have to do with whitespace.  If you remove all
the whitespace from your hard-coded examples you will see that all
three examples behave exactly the same.  For WebKit browsers you can
use the style of word-wrap: break-word to achieve the desired
results.  Other browsers rely on the presence of whitespace to
determine the line breaks.

Mike



[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread Jörn Zaefferer
Could you show your complete code, eg. provide a testpage?

Jörn

On Sun, Nov 16, 2008 at 3:21 PM, flycast [EMAIL PROTECTED] wrote:

 That does not work. This is what I have:

 function confSubmit(form) {
 if (confirm(Are you sure you want to submit the form?)) {
   $(#employmentForm).submit();
 }else{
   return false;
 }

 }//End of confSubmit function

 The form validates and submits anyway. Notice in the title I indicate
 that I am using Validate plugin,


[jQuery] how to switch event on single function

2008-11-16 Thread balavignesh

Hi friends,

  I am capturing the button  link click on the same
function , like follow...

code:-

$(a, #view).click(function(){
--
code for links (a)...
---
code for button (#view)

common for both link  button

});


 To do like the above , how can i capture the link  button
event ?

Thanks in advance,
Balavignesh


[jQuery] Re: non-programmer

2008-11-16 Thread CodingCyborg

Hello,

From my personal experience, I learned basic javascript sometime last
year. Then about a month ago a friend showed me this cool thing he
found called jQuery. jQuery allowed me to do everything I had learned
about javascript with a simple .nameofthing such has .hide()
or .animate() which made majority of my javascript obsolete.

The upside to having done javascript first was I learned the proper
format for creating Functions with parameters and the syntax for if
elseif else statements as well as loops ect. But a lot of that is very
simple and can be picked up while learning jQuery.

I suggest just jumping into jQuery, there are many examples out there
and its not too tough.

-CodingCyborg

On Nov 16, 7:04 am, ncriptide [EMAIL PROTECTED] wrote:
 I've been a graphic designer for the past 25 years. Only programming
 I know is HTML and a little CSS. I'm about to try my hand at learning
 JavaScript and AJAX . . . . should I learn JavaScript first - and then
 learn JQuery, or will I be okay just diving into JQuery?

 Just to let you know - being a designer and working off that side of
 my brain - I have to tell you - even the most simple programming
 concepts come hard to me. The books, For Dummies are over my
 head. . . I tried learning PHP/MySQL . . . had to put it aside for
 now. Just can't wrap my brain around it.

 With that said, I am dogged determined to learn all the above, but
 figure I need JavaScript first. What do you recommend? Dive into
 JQuery?


[jQuery] Re: non-programmer

2008-11-16 Thread diego valobra
Hi ncriptide, take a look at these links,

http://en.wikipedia.org/wiki/JavaScript

http://www.w3schools.com/js/default.asp

maybe useful

Diego

2008/11/16 ncriptide [EMAIL PROTECTED]


 I've been a graphic designer for the past 25 years. Only programming
 I know is HTML and a little CSS. I'm about to try my hand at learning
 JavaScript and AJAX . . . . should I learn JavaScript first - and then
 learn JQuery, or will I be okay just diving into JQuery?

 Just to let you know - being a designer and working off that side of
 my brain - I have to tell you - even the most simple programming
 concepts come hard to me. The books, For Dummies are over my
 head. . . I tried learning PHP/MySQL . . . had to put it aside for
 now. Just can't wrap my brain around it.

 With that said, I am dogged determined to learn all the above, but
 figure I need JavaScript first. What do you recommend? Dive into
 JQuery?



[jQuery] Re: Do DOM generated links treat their containers differently then hard coded?

2008-11-16 Thread Majorchamp

Thanks Mike,

I found that out later  last night while investigating. Since I
couldn't alter your code to actually add a space at the end where the
link is written out, I just went with display: inline-block; and that
seemed to fix the issue.

I will check it out in Safari, etc... and see if the display: inline-
block; didn't correct the issue there as well.

Thanks Mike

On Nov 16, 9:31 am, Mike Alsup [EMAIL PROTECTED] wrote:
  I have this test page up:http://btk.name/misc/links.html

  Basically, I am using Jquery and a Cycle plugin to allow the user to
  paginate via links through content. Simple enough.

  However, as you can see (at least in Firefox 3), the DOM generated
  links (via the plugin) keep going in 1 line outside the container.

  The links hardcoded into the actual HTML adhere to their container.

 The differences you see have to do with whitespace.  If you remove all
 the whitespace from your hard-coded examples you will see that all
 three examples behave exactly the same.  For WebKit browsers you can
 use the style of word-wrap: break-word to achieve the desired
 results.  Other browsers rely on the presence of whitespace to
 determine the line breaks.

 Mike


[jQuery] iterate array and create callback

2008-11-16 Thread bob

Is it possible to iterate over the array and create functions as
follows?
It did not seem to work for me.

var menu = ['home','news','sport','music'];

for(var i=0; imenu.length;i++) {


$('#'+menu[i]+'_header').click(function(){ alert(i);
alert(menu[i]+'_header clicked');


var $img = $(this).find('img');
var src = $img.attr('src');
var newsrc = /up\.gif$/.test(src) ? src.replace
('up','down') :
src.replace('down','up');
$img.attr('src',newsrc);


});
}


[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread flycast

I do not want to post a page publicly. The code is very long.


[jQuery] Re: Do DOM generated links treat their containers differently then hard coded?

2008-11-16 Thread Majorchamp

In regards to my last post, I can't understand why adding a space at
the end of the link would't work. If I added any text at all, it
didn't take

var $a = (typeof opts.pagerAnchorBuilder == 'function')
? $(opts.pagerAnchorBuilder(i,el))
: $('a href=#'+(i+1)+'/a');


This didn't work:
 : $('a href=#'+(i+1)+'/ablahblahblah');

On Nov 16, 9:31 am, Mike Alsup [EMAIL PROTECTED] wrote:
  I have this test page up:http://btk.name/misc/links.html

  Basically, I am using Jquery and a Cycle plugin to allow the user to
  paginate via links through content. Simple enough.

  However, as you can see (at least in Firefox 3), the DOM generated
  links (via the plugin) keep going in 1 line outside the container.

  The links hardcoded into the actual HTML adhere to their container.

 The differences you see have to do with whitespace.  If you remove all
 the whitespace from your hard-coded examples you will see that all
 three examples behave exactly the same.  For WebKit browsers you can
 use the style of word-wrap: break-word to achieve the desired
 results.  Other browsers rely on the presence of whitespace to
 determine the line breaks.

 Mike


[jQuery] Ajax / XmlHttpRequest Problems with some routers / providers ( MTU) ( No jQuery problem!)

2008-11-16 Thread [EMAIL PROTECTED]

Hi,

we're running a recently launched website ( http://www.smashdown.net).
We're using AJAX requests (in JSON) to communicate with our servers.

A couple of customers complained about that some functionalities on
our website are not working. We've found out that some AJAX requests
does simply timeout (because they're not send to our servers).

We further found out that this only occurs to a couple of customers.
Now we've been able to track down the problem. There is a customer
using Alice DSL (a german internet provider). This customer uses a D-
Link WLAN router to connect to the internet.

If this customer is sending the AJAX request, it will not processed
( in fact, the request is not sent to our server). When this customer
does not using the D-Link router (by connecting his computer directly
to the DSL modem), everything works.

We visited the customer at home :-) and tried to change each possible
setting on the router. When we've changed the MTU value from 1492 to
1452 (as suggested by his internet provider). Now everything
works. :-) This happened on a Mac Book (Firefox  Safari ) and Linux
(Firefox).

My question is if anybody else encountered similar problems when using
AJAX. Of course, it seems to be a problem of the customer, if he is
using the wrong MTU.

BUT: It's not very easy to tell our customers that they should use the
right MTU, because all other common websites are working with this MTU
(they are thinking their internet is working, of course).

For a quick and dirty fix we could use a hidden iframe instead of AJAX
request. But that's not really a good solutions.

Maybe some of you had similar problems like this? I know, that this is
not a jQuery issue, but I think this is a good place to ask other
developers using AJAX if they had similar problems (and maybe found a
good solution for this)?

Greetings
Christian


[jQuery] combined functionallity: validate + confirm form

2008-11-16 Thread Miguel Griffa

Hi
I'd like to have a form that uses validate plugin, but uses submit
confirmation too.
ideally this would be a js confirm or a custom function, but that's a
minor issue.

My question is: is there a way to extend validate (or plug in) a
custom confirmation fuction?

or: is there a way of combining validate (and some other plugin or
code) to achieve this?

thanks in advance!

PS: I've discovered jquery a few months ago and I love it, I hope to
be able to contribute to
such a great project

Migue


[jQuery] Help in using JQUERY BLOCKUI

2008-11-16 Thread uniquegodwin

Hello,
I am trying to use the Jquery BLOCKUI pluginbut with no success...
As per the examples on that page,I tried passing my custom
message,etcit doesn't work.

No matter what I try,it only displays the default Please Wait...
message :-(
What could possibly be the cause of this symptom??
Thanks so much


[jQuery] Re: Help in using JQUERY BLOCKUI

2008-11-16 Thread Mike Alsup

 I am trying to use the Jquery BLOCKUI pluginbut with no success...
 As per the examples on that page,I tried passing my custom
 message,etcit doesn't work.

 No matter what I try,it only displays the default Please Wait...
 message :-(


What version of the plugin are you using?  What does your code look
like?  Can you post a link that shows the problem?




[jQuery] [jQuery][Treeview] How can I create ROOT node for the tree

2008-11-16 Thread Pham Anh Tuan

Hi all,

Anyone knows how to create ROOT node for the tree, sth like below

ROOT --- I want to create this Node
- Home
- Campany

Thanks for reading and looking your all help :)

bowlkhin



[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread flycast

Here is the JS code. I have removed a bunch of Validation rules to
shorten it up. The code at the bottom is the problem.

$(document).ready(function(){
   $(#employmentForm).validate({
debug: false,

rules: {
emp_applicationDate: {
required: true,
minlength: 2
}

}, //End of rules section

messages: {
emp_termsAgreed: {
minlength: You must agree to the Terms and 
Conditions above to
submit.
}//End of emp_termsAgreed section
}//End of Messages section


});//End of form validation


//Show the detail for each control that has Query on the end of the
name.
$([name$='Query']).click(function(){
if($(this).val() == Yes){
$([name='+$(this).attr(name)+Yes']).slideDown();
$([name='+$(this).attr(name)+No']).slideUp();
}else{
$([name='+$(this).attr(name)+Yes']).slideUp();
$([name='+$(this).attr(name)+No']).slideDown();
}
});


$([name$='Query']).each(function(){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).hide();
});

/*Hide all detail sections - to do this we need to check their value
first.
It is possible that they have already been checked and the page was
just refreshed.
To deal with this we need to close all the detail areas first and
then show the
detail areas that are checked yes.
*/


$([name$='Query']).each(function(){
if ($(this).attr(checked) == true  $(this).attr(value) ==
Yes ){
$([name='+$(this).attr(name)+Yes']).show();
$([name='+$(this).attr(name)+No']).hide();
}
if ($(this).attr(checked) == true  $(this).attr(value) ==
No ){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).show();
}
});



//Build names for signature

$([name^='emp_name']).blur(function () {
  $(#namePrompt).text(Example: +$([name='emp_nameLast']).val
());
var middleName = $([name='emp_nameMiddle']).val();
if (middleName.length  0){
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
+$([name='emp_nameMiddle']).val()+ +$([name='emp_nameLast']).val
());
}else{
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
+$([name='emp_nameLast']).val());
}
});

jQuery.validator.addMethod( testvalue,
function(value, params) {
   if (params.checked){
  return true;
   }else{
  return false;
   }
 }, It is required that you read and agree to the Terms and Agreement
above before submitting your application.);

});//End of document ready function

function confSubmit(form) {
if (confirm(Are you sure you want to submit the form?)) {
   $(#employmentForm).submit();
}else{
   return false;
}

}//End of confSubmit function


[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread flycast

Here is the code. I have removed a bunch of Validation rules to make
it shorter. The problem code is at the bottom.

$(document).ready(function(){
   $(#testForm).validate({
debug: false,

rules: {
emp_applicationDate: {
required: true,
minlength: 2
}

}, //End of rules section

messages: {
termsAgreed: {
minlength: You must agree to the Terms and 
Conditions above to
submit.
}//End of emp_termsAgreed section
}//End of Messages section


});//End of form validation


//Show the detail for each control that has Query on the end of the
name.
$([name$='Query']).click(function(){
if($(this).val() == Yes){
$([name='+$(this).attr(name)+Yes']).slideDown();
$([name='+$(this).attr(name)+No']).slideUp();
}else{
$([name='+$(this).attr(name)+Yes']).slideUp();
$([name='+$(this).attr(name)+No']).slideDown();
}
});


$([name$='Query']).each(function(){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).hide();
});

/*Hide all detail sections - to do this we need to check their value
first.
It is possible that they have already been checked and the page was
just refreshed.
To deal with this we need to close all the detail areas first and
then show the
detail areas that are checked yes.
*/


$([name$='Query']).each(function(){
if ($(this).attr(checked) == true  $(this).attr(value) ==
Yes ){
$([name='+$(this).attr(name)+Yes']).show();
$([name='+$(this).attr(name)+No']).hide();
}
if ($(this).attr(checked) == true  $(this).attr(value) ==
No ){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).show();
}
});



//Build names for signature

$([name^='emp_name']).blur(function () {
  $(#namePrompt).text(Example: +$([name='emp_nameLast']).val
());
var middleName = $([name='emp_nameMiddle']).val();
if (middleName.length  0){
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
+$([name='emp_nameMiddle']).val()+ +$([name='emp_nameLast']).val
());
}else{
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
+$([name='emp_nameLast']).val());
}
});


jQuery.validator.addMethod( testvalue,
function(value, params) {
   if (params.checked){
  return true;
   }else{
  return false;
   }
 }, It is required that you read and agree to the Terms and Agreement
above before submitting.);

});//End of document ready function

function confSubmit(form) {
if (confirm(Are you sure you want to submit the form?)) {
   $(#testForm).submit();
}else{
   return false;
}

}//End of confSubmit function


[jQuery] Re: delayed tooltip hiding

2008-11-16 Thread martin

It looks I solved it. For those who could have same problem, the
solution was to store timer ids in an array instead of storing it in
one variable. on mouseout you need to push a new id into array and on
mouseover just check the array length. If there were any items, shift
them in a for loop and use clearTimeout on these shifted ids.
If you want more info or you think the explanation is confusing, don't
be shy to ask ;) I'll try to advise.


[jQuery] Re: combined functionallity: validate + confirm form

2008-11-16 Thread Jörn Zaefferer
Try this:

$(...).validate({
  submitHandler: function(form) {
if (confirm(Really?) {
  form.submit();
}
  }
});

Jörn

On Sun, Nov 16, 2008 at 4:36 PM, Miguel Griffa [EMAIL PROTECTED] wrote:

 Hi
 I'd like to have a form that uses validate plugin, but uses submit
 confirmation too.
 ideally this would be a js confirm or a custom function, but that's a
 minor issue.

 My question is: is there a way to extend validate (or plug in) a
 custom confirmation fuction?

 or: is there a way of combining validate (and some other plugin or
 code) to achieve this?

 thanks in advance!

 PS: I've discovered jquery a few months ago and I love it, I hope to
 be able to contribute to
 such a great project

 Migue



[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread Jörn Zaefferer
Just posted to a different thread, but should work here, too:

$(...).validate({
 submitHandler: function(form) {
   if (confirm(Really?) {
 form.submit();
   }
 }
});

Jörn

On Sun, Nov 16, 2008 at 5:33 PM, flycast [EMAIL PROTECTED] wrote:

 Here is the code. I have removed a bunch of Validation rules to make
 it shorter. The problem code is at the bottom.

 $(document).ready(function(){
   $(#testForm).validate({
debug: false,

rules: {
emp_applicationDate: {
required: true,
minlength: 2
}

}, //End of rules section

messages: {
termsAgreed: {
minlength: You must agree to the Terms and 
 Conditions above to
 submit.
}//End of emp_termsAgreed section
}//End of Messages section


});//End of form validation


//Show the detail for each control that has Query on the end of the
 name.
$([name$='Query']).click(function(){
if($(this).val() == Yes){
$([name='+$(this).attr(name)+Yes']).slideDown();
$([name='+$(this).attr(name)+No']).slideUp();
}else{
$([name='+$(this).attr(name)+Yes']).slideUp();
$([name='+$(this).attr(name)+No']).slideDown();
}
});


$([name$='Query']).each(function(){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).hide();
});

/*Hide all detail sections - to do this we need to check their value
 first.
It is possible that they have already been checked and the page was
 just refreshed.
To deal with this we need to close all the detail areas first and
 then show the
detail areas that are checked yes.
*/


$([name$='Query']).each(function(){
if ($(this).attr(checked) == true  $(this).attr(value) ==
 Yes ){
$([name='+$(this).attr(name)+Yes']).show();
$([name='+$(this).attr(name)+No']).hide();
}
if ($(this).attr(checked) == true  $(this).attr(value) ==
 No ){
$([name='+$(this).attr(name)+Yes']).hide();
$([name='+$(this).attr(name)+No']).show();
}
});



 //Build names for signature

 $([name^='emp_name']).blur(function () {
  $(#namePrompt).text(Example: +$([name='emp_nameLast']).val
 ());
 var middleName = $([name='emp_nameMiddle']).val();
 if (middleName.length  0){
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
 +$([name='emp_nameMiddle']).val()+ +$([name='emp_nameLast']).val
 ());
 }else{
  $(#namePrompt).text(Ex: +$([name='emp_nameFirst']).val()+
 +$([name='emp_nameLast']).val());
 }
 });


 jQuery.validator.addMethod( testvalue,
 function(value, params) {
   if (params.checked){
  return true;
   }else{
  return false;
   }
  }, It is required that you read and agree to the Terms and Agreement
 above before submitting.);

 });//End of document ready function

 function confSubmit(form) {
 if (confirm(Are you sure you want to submit the form?)) {
   $(#testForm).submit();
 }else{
   return false;
 }

 }//End of confSubmit function



[jQuery] Re: jqRevolve - new, simplistic carousel-like plugin released!

2008-11-16 Thread Andrea - Aosta

The web site don't work (Safari e FF under MAC).

On Nov 12, 11:38 pm, Brice Burgess [EMAIL PROTECTED] wrote:
 Ladies and Gentlemen,

   I'm writing to inform you all of a new addition to the jQuery plugin
 family... Please welcome jqRevolve!

   jqRevolve is a carousel-like plugin for jQuery. It provides a
 component that scrolls arbitrary content (Images, Markup, Text, Iframes,
 You Name it) in a defined 'clip region'. Yes, there are many out there.
 I needed a lightweight component that features automatic clip region
 sizing as well as pressure based scrolling. It is easy to use and customize.

   Checkout the plugin page for demonstrations. It is adequately boring
 enough for science. The examples can use some sprucing up by a
 designer -- if any volunteer.

 http://dev.iceburg.net/jquery/jqRevolve/

   Regards,

 ~ Brice


[jQuery] Re: [jQuery][Treeview] How can I create ROOT node for the tree

2008-11-16 Thread Dirceu Barquette
Hi,
I've been developing this plugin:
http://sourceforge.net/projects/jqtreevial/

download the demo version and enjoy.

Dirceu Barquette



2008/11/16 Pham Anh Tuan [EMAIL PROTECTED]


 Hi all,

 Anyone knows how to create ROOT node for the tree, sth like below

 ROOT --- I want to create this Node
 - Home
 - Campany

 Thanks for reading and looking your all help :)

 bowlkhin




[jQuery] Re: Help in using JQUERY BLOCKUI

2008-11-16 Thread uniquegodwin

I downloaded just today...the latest available on the site...V2
I tried copying and pasting the lines from the site after adding the
javascript reference on to my webpage..
 Usage is very simple; to block user activity for the page:

$.blockUI();

Blocking with a custom message:

$.blockUI({ message: 'h1img src=busy.gif / Just a moment.../
h1' });

Blocking with custom style:

$.blockUI({ css: { backgroundColor: '#f00', color: '#fff'} });

To unblock the page:

$.unblockUI();

If you want to use the default settings and have the UI blocked for
all ajax requests, it's as easy as this:

$().ajaxStart($.blockUI).ajaxStop($.unblockUI);



But,no matter what I add,it shows only Please wait. It doesn't
display the text I add...

What should I do to make it work?
Please help me out...Thanks..


On Nov 16, 8:50 pm, Mike Alsup [EMAIL PROTECTED] wrote:
  I am trying to use the Jquery BLOCKUI pluginbut with no success...
  As per the examples on that page,I tried passing my custom
  message,etcit doesn't work.

  No matter what I try,it only displays the default Please Wait...
  message :-(

 What version of the plugin are you using?  What does your code look
 like?  Can you post a link that shows the problem?


[jQuery] Re: Validate. Can I validate using 2 values?

2008-11-16 Thread shapper

Sorry, is there any example using validate for this?

To be honest I am completely lost on how to do this ...

Thank You,
Miguel

On Nov 16, 10:39 am, Jörn Zaefferer [EMAIL PROTECTED]
wrote:
 I mean

 $().ajaxSend(function() {

 });

 Jörn

 On Sun, Nov 16, 2008 at 1:24 AM, shapper [EMAIL PROTECTED] wrote:

  Hi Jorn,

  You mean using:

   $.ajax({
    beforeSend: function(){
    }
   });

  And in before send get the value of the text box and add it to the
  ajax validate request of the validate?

  But how can I link it to the Validate email validation?

  Thanks,
  Miguel

  On Nov 15, 2:21 pm, Alexsandro_xpt [EMAIL PROTECTED] wrote:
  And about form submit before to validate e-mail field?

  Do you know something about that?

  Thanks
  Alexsandro

  On 13 nov, 14:00, Jörn Zaefferer [EMAIL PROTECTED]
  wrote:

   The plugin doesn't support that. As a workaround, you can use jQuery's
   ajaxSend callback to add additional data to the 
   request:http://docs.jquery.com/Ajax/ajaxSend#callback

   Jörn

   On Thu, Nov 13, 2008 at 3:35 PM, shapper [EMAIL PROTECTED] wrote:

Hello,

I am using the following to validate an email field:

Email: { email: true, remote: /Account/FindEmail, required: true }

I am checking if there is already an account with that email.

In my form I also have an input where the user inserts its username.
When validating the email I need to send also the Username an not only
the email.

Can I do this?

Thanks,
Miguel


[jQuery] Re: Validate. Can I validate using 2 values?

2008-11-16 Thread Jörn Zaefferer
This would add the username to all requests:

$().ajaxSend(function(event, XMLHttpRequest, ajaxOptions) {
  ajaxOptions.data.username = $(#username).val();
});

Jörn

On Sun, Nov 16, 2008 at 7:18 PM, shapper [EMAIL PROTECTED] wrote:

 Sorry, is there any example using validate for this?

 To be honest I am completely lost on how to do this ...

 Thank You,
 Miguel

 On Nov 16, 10:39 am, Jörn Zaefferer [EMAIL PROTECTED]
 wrote:
 I mean

 $().ajaxSend(function() {

 });

 Jörn

 On Sun, Nov 16, 2008 at 1:24 AM, shapper [EMAIL PROTECTED] wrote:

  Hi Jorn,

  You mean using:

   $.ajax({
beforeSend: function(){
}
   });

  And in before send get the value of the text box and add it to the
  ajax validate request of the validate?

  But how can I link it to the Validate email validation?

  Thanks,
  Miguel

  On Nov 15, 2:21 pm, Alexsandro_xpt [EMAIL PROTECTED] wrote:
  And about form submit before to validate e-mail field?

  Do you know something about that?

  Thanks
  Alexsandro

  On 13 nov, 14:00, Jörn Zaefferer [EMAIL PROTECTED]
  wrote:

   The plugin doesn't support that. As a workaround, you can use jQuery's
   ajaxSend callback to add additional data to the 
   request:http://docs.jquery.com/Ajax/ajaxSend#callback

   Jörn

   On Thu, Nov 13, 2008 at 3:35 PM, shapper [EMAIL PROTECTED] wrote:

Hello,

I am using the following to validate an email field:

Email: { email: true, remote: /Account/FindEmail, required: true }

I am checking if there is already an account with that email.

In my form I also have an input where the user inserts its username.
When validating the email I need to send also the Username an not only
the email.

Can I do this?

Thanks,
Miguel


[jQuery] Re: how to switch event on single function

2008-11-16 Thread ricardobeat

$(a, #view).click(function(){

   if (this.id == view) {
   //code for button
   } else {
   //code for links
   }
   //common
});

You can also use 3 distinct functions for the same effect:

$(a, #view)
   .click(function(){
   //common
   }).filter('a').click(function(){
   //links
   }).end().filter('#view').click(function(){
   //button
   });

- ricardo


On Nov 16, 12:47 pm, balavignesh [EMAIL PROTECTED] wrote:
 Hi friends,

           I am capturing the button  link click on the same
 function , like follow...

 code:-

 $(a, #view).click(function(){
 --
 code for links (a)...
 ---
 code for button (#view)
 
 common for both link  button
 

 });

          To do like the above , how can i capture the link  button
 event ?

 Thanks in advance,
 Balavignesh


[jQuery] Re: image toggle

2008-11-16 Thread ricardobeat

It's easier to just add a class to all the headers, then use $
('.menuheaders').click(...);

On Nov 16, 12:43 am, bob [EMAIL PROTECTED] wrote:
 Thanks ricardo,

 Is it possible to do something like this?
 It did not seem to work for me.

 var menu = ['home','news','sport','music'];

 for(var i=0; imenu.length;i++) {

         $('#'+menu[i]+'_header').click(function(){
                 alert(menu[i]+'_header clicked');

                 var $img = $(this).find('img');
                 var src = $img.attr('src');
                 var newsrc = /up\.gif$/.test(src) ? src.replace('up','down') :
 src.replace('down','up');
                 $img.attr('src',newsrc);

         });

 }


[jQuery] Re: iterate array and create callback

2008-11-16 Thread ricardobeat

see response at the original thread:

http://groups.google.com/group/jquery-en/browse_thread/thread/37906be6845780c2?hl=en

On Nov 16, 1:43 pm, bob [EMAIL PROTECTED] wrote:
 Is it possible to iterate over the array and create functions as
 follows?
 It did not seem to work for me.

 var menu = ['home','news','sport','music'];

 for(var i=0; imenu.length;i++) {

         $('#'+menu[i]+'_header').click(function(){ alert(i);
                 alert(menu[i]+'_header clicked');

                 var $img = $(this).find('img');
                 var src = $img.attr('src');
                 var newsrc = /up\.gif$/.test(src) ? src.replace
 ('up','down') :
 src.replace('down','up');
                 $img.attr('src',newsrc);

         });

 }


[jQuery] Re: Pause after .load request

2008-11-16 Thread ricardobeat

There is no 'delay' or 'pause' in Javascript, you have to use a
timeout or interval. Maybe this will work (interval, vars passed with
a closure, if instead of while):

$(document).ready(function() {

   var date_reg = $(input#date_requested).val();
   var counter = -1;
   slideTimer = setInterval((function(date,counter){ //global var
  if (counter = date) {
 $('#result').load('/get_time_lapse.pl',
{date_requested:date});
 counter++;
 date--;
   } else { clearInterval(slideTimer); }
   })(date_reg,counter),2000);

});

- ricardo

On Nov 16, 3:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Hello,

 I'm trying to fetch some data from a Perl script and have it begin to
 display as many times as there is data. More or less a data
 slideshow. The data is actually very visual, but at the moment, i dont
 want to implement a pause, forward/backward option, until I get the
 automatic option working.

 Basically what I'm trying to do is have the content load, wait, load,
 wait, etcWith a reasonable 2 - 3 seconds between each load...Here
 is the code I have that isn't quite working:

         $(document).ready(function() {
                 var date_reg = $(input#date_requested).val();
                 var counter = -1;
                 while (counter = date_reg)
                 {
                         $(#result).load('/get_time_lapse.pl', 
 {date_requested:
 date_reg});
                         counter = counter + 1;
                         date_reg = date_reg - 1;
                 }
         });

 where date_reg is just the number of times I want to load the screens.
 However, if I look at the logs for my Perl script, it does say all 10
 calls, immediately, as fast as it can. I've tried to put a javascript
 pause or whatever that function was called in here, but it doesnt seem
 to work.

 Any suggestions to implement a pause between each .load?

 Thanks


[jQuery] Re: non-programmer

2008-11-16 Thread Isaak Malik
Starting off with a framework is never a good way to get to learn a
technology, even if you start with jQuery you'll still have to learn the
JavaScript syntax, built-in functions, and all the rest.. Moreover, there is
a basic you have to know before using jQuery because jQuery is not a
language itself but just a framework.

A framework is only good to extend your knowledge and improve development
and not to teach you the basics of a technology.

And about PHP, don't let it discourage you, it is incredibly easy to learn
and to use as soon as you get the hang of it. It's so easy that even the
not-so-brightest think it's simple.

Leave MySQL for last, learn the PHP basics first then take the next step. I
also suggest you use an IDE (Eclipse, NetBeans, Komodo, etc.) that supports
calltips for the built-in functions, this can save you a lot of time at the
beginning.

-- 
Isaak Malik
Web Developer


[jQuery] Its possible to do this??

2008-11-16 Thread SoutlinK

Hi.

I am new with jQuery, and i want to know if its possible to do the
follow.

var row = $(.flexigrid .bDiv #socios .trSelected:first);
$(row +  td:first).css(color, red);

Or something like that.

I mean.

I have a row selected in jQuery. Now I want to go for each column, of
this row without do this
var col0 = $(.flexigrid .bDiv #socios .trSelected:first td:eq(0));

Thanks


[jQuery] Re: jeditable autocomplete - time to revisit?

2008-11-16 Thread tennis_blues

yes, thanks...this is exactly what i needed!  your jeditable is great

On Nov 14, 2:24 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 That is exactly why I posted. I noticed that you had done a lot of
 work on inputs. Unfortunately I could not figure out how to do it
 myself from reading through your website. Thanks again for your help.

 -jl

 On Nov 13, 1:51 am, Mika Tuupola [EMAIL PROTECTED] wrote:



  On Nov 12, 2008, at 9:25 PM, [EMAIL PROTECTED] wrote:

   Wow, that was sooo simple. Works like a charm!
   Impressive.. Now, thats the way a plugin should work.
   Nice work Mike.

  Thank you :) Usually when someone has the need to do something special  
  (such as useautocomplete) withJeditablethere is no need to touch  
  Jeditablecode itself. All you need to do is to write a custom input.

  The reason why I created the plugin architecture (plugins for plugin)  
  was to avoid bloat. Take 10 people and they have at least eight  
  different needs. Making all their needs a configurable option would  
  bloat the code.

  Thus the solution: Make all basic features configurable and create API  
  with which people can extend the features how ever they want.

  --
  Mika Tuupolahttp://www.appelsiini.net/- Hide quoted text -

 - Show quoted text -


[jQuery] Jquery how to get attribute from a HttpServletRequest

2008-11-16 Thread Mazi



Hallo all: I got this piece of code:

$(#faq).click(function () {
 var url = $.get(faq, { pagina: page });
 alert(url);
});

On faq responds a Servlet tha set an attribute on the request 
request.setAttribute(pageFAQ, pageFAQ); 

After the get jqeury print me [object XmlHttpRequest I would like to
access to the attribute setted in the Servlet but I dunno how to do.

Any idea?

Kind regards

Massimo UGues


[jQuery] Re: Help in using JQUERY BLOCKUI

2008-11-16 Thread Mike Alsup

 But,no matter what I add,it shows only Please wait. It doesn't
 display the text I add...

 What should I do to make it work?

I think you need to post a link to what you have.  Obviously the
plugin does work per the sample pages, so maybe it's just a typo on
your part or something.


[jQuery] Why is the behavior only attached to the first select?

2008-11-16 Thread Fluffy Convict

I'm trying to attach a function to all selects that have the custom
goto-attribute. It works for the first one, but the behavior isn't
being attached to the second select. Any ideas how to fix it?

$(document).ready(function() {
  $('select[goto]').each(function () {
$(this).change(function () {
  var selected = $(select option:selected).val();
  if (selected != 'ignore') {
document.location = $(this).attr(goto) + '/' + selected;
  }
});
  });
});

// with html:

select goto=www.cnn.com
  option value=ignoreChoose...
  option value=financeCNN Finance
  option value=sportsCNN Sports
/select

select goto=www.bbc.co.uk
  option value=ignoreChoose...
  option value=financeBBC Finance
  option value=sportsBBC Sports
/select


[jQuery] Re: jeditable and XHTML?

2008-11-16 Thread Mika Tuupola



On Nov 15, 2008, at 2:24 AM, Rodent of Unusual Size wrote:
http://github.com/tuupola/jquery_jeditable/tree/master/ 
jquery.jeditab...


Brilliant!  Works a treat now.


Ok great :)


Thanks for the heads up!


You betcha.  Who closes the tracker item?



i can close.

--
Mika Tuupola
http://www.appelsiini.net/



[jQuery] Re: Why is the behavior only attached to the first select?

2008-11-16 Thread Jason Huck

This line is the likely culprit, because the css selector is not
specific to an individual select element:

  var selected = $(select option:selected).val();

Try this instead, to constrain the selection within the current
context:

  var selected = $(option:selected, this).val();

Or, IIRC, I believe this works nowadays as well:

  var selected = $(this).val();

You might also consider storing the base URLs in an associative array
rather than relying on custom (non-validating) attributes.

HTH,
Jason


On Nov 16, 3:08 pm, Fluffy Convict [EMAIL PROTECTED] wrote:
 I'm trying to attach a function to all selects that have the custom
 goto-attribute. It works for the first one, but the behavior isn't
 being attached to the second select. Any ideas how to fix it?

 $(document).ready(function() {
   $('select[goto]').each(function () {
     $(this).change(function () {
       var selected = $(select option:selected).val();
       if (selected != 'ignore') {
         document.location = $(this).attr(goto) + '/' + selected;
       }
     });
   });

 });

 // with html:

 select goto=www.cnn.com
   option value=ignoreChoose...
   option value=financeCNN Finance
   option value=sportsCNN Sports
 /select

 select goto=www.bbc.co.uk
   option value=ignoreChoose...
   option value=financeBBC Finance
   option value=sportsBBC Sports
 /select


[jQuery] Re: Its possible to do this??

2008-11-16 Thread Mauricio (Maujor) Samy Silva


Try the core jQuery function: jQuery(expression, [context])
http://docs.jquery.com/Core/jQuery#expressioncontext

$('td:first', row).css('color', 'red');

Maurício



Hi.

I am new with jQuery, and i want to know if its possible to do the
follow.

var row = $(.flexigrid .bDiv #socios .trSelected:first);
$(row +  td:first).css(color, red);

Or something like that.

I mean.

I have a row selected in jQuery. Now I want to go for each column, of
this row without do this
var col0 = $(.flexigrid .bDiv #socios .trSelected:first td:eq(0));

Thanks 




[jQuery] Re: Its possible to do this??

2008-11-16 Thread Jason Huck

If you want to concatenate strings in order to create selectors, don't
make them jQuery objects first. In other words, just do this:

var row = .flexigrid .bDiv #socios .trSelected:first;
$(row +  td:first).css(color, red);

Also, as long as your ID's are unique, which they should be, there's
no need to put anything in front of them in your selector, so you
should be able to shorten it like so:

var row = #socios.trSelected:first;
$(row +  td:first).css(color, red);

HTH,
Jason


On Nov 16, 11:30 am, SoutlinK [EMAIL PROTECTED] wrote:
 Hi.

 I am new with jQuery, and i want to know if its possible to do the
 follow.

 var row = $(.flexigrid .bDiv #socios .trSelected:first);
 $(row +  td:first).css(color, red);

 Or something like that.

 I mean.

 I have a row selected in jQuery. Now I want to go for each column, of
 this row without do this
 var col0 = $(.flexigrid .bDiv #socios .trSelected:first td:eq(0));

 Thanks


[jQuery] Re: help with jquery add/remove class

2008-11-16 Thread Jason Huck

I would suggest dropping the add-/remove- class stuff entirely in
favor of simply switching out the background image. Try something like
this:

// Attach a click event to every input in the .nav section.
$('div.nav input').click(function(){
// Extract the specific floor plan from the class.
// (Consider using ID's for this instead, since they are unique.)
var fp = $(this).attr('class').substr(4);

// Switch the viewer's background-image attribute.
$('p.viewer').css('background-image', 'url(graphics/' + fp + '.png');
});


HTH,
Jason




On Nov 15, 6:44 pm, bjreed [EMAIL PROTECTED] wrote:
 Hello.  I am new to JQuery, and I thought I'd try creating a small app
 to learn more.  I've hit a problem that I cannot seem to fix.   I have
 a right navigation bar with 8 floor plan links.  When you click one,
 the accordian menu drops and shows some details (this works great),
 the other thing that is suppose to happen on click is a large image is
 to appear in the left area.  You'll see that it works fine at first,
 BUT when you start clicking down the list AND then try and return to
 an earlier click, is when the problem occurs.  It seems there is
 problem removing the classes that have already been called.

 I know that there is probably an easy solution, but I have not found
 it yet.  I'd appreciate any advice.  Thanks

 You can view it athttp://jquery.pixeltrails.com/
 All the script is on the default.htm source page.  Add/Remove class
 script is at the bottom of the source.


[jQuery] Re: Validate. Can I validate using 2 values?

2008-11-16 Thread shapper

In this case I have only the validate request for the password field
that also sends the username for the test ...

But if I would have various requests, from validate or others,
shouldn't I add the username only to the password validate request?

Is this possible?

Thanks,
Miguel

On Nov 16, 6:45 pm, Jörn Zaefferer [EMAIL PROTECTED]
wrote:
 This would add the username to all requests:

 $().ajaxSend(function(event, XMLHttpRequest, ajaxOptions) {
   ajaxOptions.data.username = $(#username).val();

 });

 Jörn

 On Sun, Nov 16, 2008 at 7:18 PM, shapper [EMAIL PROTECTED] wrote:

  Sorry, is there any example using validate for this?

  To be honest I am completely lost on how to do this ...

  Thank You,
  Miguel

  On Nov 16, 10:39 am, Jörn Zaefferer [EMAIL PROTECTED]
  wrote:
  I mean

  $().ajaxSend(function() {

  });

  Jörn

  On Sun, Nov 16, 2008 at 1:24 AM, shapper [EMAIL PROTECTED] wrote:

   Hi Jorn,

   You mean using:

    $.ajax({
     beforeSend: function(){
     }
    });

   And in before send get the value of the text box and add it to the
   ajax validate request of the validate?

   But how can I link it to the Validate email validation?

   Thanks,
   Miguel

   On Nov 15, 2:21 pm, Alexsandro_xpt [EMAIL PROTECTED] wrote:
   And about form submit before to validate e-mail field?

   Do you know something about that?

   Thanks
   Alexsandro

   On 13 nov, 14:00, Jörn Zaefferer [EMAIL PROTECTED]
   wrote:

The plugin doesn't support that. As a workaround, you can use jQuery's
ajaxSend callback to add additional data to the 
request:http://docs.jquery.com/Ajax/ajaxSend#callback

Jörn

On Thu, Nov 13, 2008 at 3:35 PM, shapper [EMAIL PROTECTED] wrote:

 Hello,

 I am using the following to validate an email field:

 Email: { email: true, remote: /Account/FindEmail, required: true }

 I am checking if there is already an account with that email.

 In my form I also have an input where the user inserts its username.
 When validating the email I need to send also the Username an not 
 only
 the email.

 Can I do this?

 Thanks,
 Miguel


[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread flycast

Thanks!

I am having a hard time getting my form to validate now. Would I place
my rules here?

$(...).validate({
 submitHandler: function(form) {
   if (confirm(Really?)) {
 rules...
 messages...
 etc...
 form.submit();
   }else{
 //stuff to do if the form does not validate
 }
}

});


[jQuery] ajax loading image and fadeIn content

2008-11-16 Thread led

Hi, i'm just starting in jquery and i need help on this code.
I just need to display a message (or image)before the content is
loaded and fade that content.
Here is the code, and you can see it in action on realferias.com and
click the OK button on the left.Thanks.

$(document).ready(function() {
 $('#foo').click(function() {

  $('#centro').empty();

  $('#centro').fadeIn(slow).load('results_casa_mes.asp',{ nm_mes:
document.getElementById('teste4').value, pessoas:
document.getElementById('pessoas').value, tipo: document.getElementById
('tipo').value, localidade: document.getElementById
('localidade').value });
  });

 });

  $(function()
{
   $('#centro').ajaxSend(function(e,r,s)
   {
  $(this).append(liStarting request  /li);
   });

});



[jQuery] [FIX] Google maps and jQuery tabs... My solution.

2008-11-16 Thread Micky Hulse

Hey guys/gals,

For some reason, I only have the option to Reply to author on this
thread:

http://groups.google.com/group/jquery-en/browse_thread/thread/
484d6cd5fd2a64cd

So I am starting a new thread here...

For me, the technique Klaus proposed worked when I added
display:block:

.tabs .ui-tabs-hide { display: none; }
/* Fixes google maps: */
.tabs #story-map-tab.ui-tabs-hide {
display: block;
position: absolute;
top: -999em;
left: -999em;
}

For my particular setup, I only wanted the Maps tab to use
position:absolute... All other tabs were fine using display:none

Anyway, the key, for me, is the display: block.

...and the CSS must come before any of your JS for this to work.

Before I used display block, I was getting a lot of gray boxes on my
tabbed map object.

Cheers!
Micky



[jQuery] Re: livequery not binding to ajax loaded links in ie6 and ie7?

2008-11-16 Thread Brandon Aaron
No worries! Glad you got it figured out and sorry I wasn't able to get back
to you sooner. :)
--
Brandon Aaron

On Sat, Nov 15, 2008 at 2:39 PM, n00bert [EMAIL PROTECTED] wrote:


 Got it sorted. ie doesn't like the selector. Now using a different
 method, but still with livequery. Sorry to have bothered you Brandon,
 and thanks for such a powerful plugin.

 Sameer

 On Nov 14, 9:50 pm, n00bert [EMAIL PROTECTED] wrote:
  Hi Brandon,
 
  I've tried changing this code:
 
  $('#mainMenu ul li ul li a[href$=' + href + ']').triggerHandler
  ('click');
 
  to:
 
  $('#mainMenu ul li ul li a:first').triggerHandler('click');
 
  in order to see if it was the selector that's causing the problem. It
  seems it is. The second line of code works as expected in ie6 and ie7.
 
  Is there another way of selecting a link with a href that matches the
  clicked link's href?
 
  Thanks,
 
  Sameer
 
  On Nov 14, 3:31 pm, n00bert [EMAIL PROTECTED] wrote:
 
   Hi Brandon,
 
   no errors in ie at all. I've uploaded the site I'm working on
 athttp://rosiespencer.co.ukWhenit loads, click a small thumb. The menu
   should slide down and the contents of #content are replaced via ajax.
   Some larger thumbs appear. This is where it breaks in ie. In other
   browsers if you click one of the bigger thumbs, #content is replaced
   as expected.
 
   Thanks again for your help,
 
   Sameer
 
   On Nov 14, 2:23 pm, Brandon Aaron [EMAIL PROTECTED] wrote:
 
On Thu, Nov 13, 2008 at 10:26 PM, n00bert [EMAIL PROTECTED]
 wrote:
 
 Hi Brandon,
 
 I put an alert in like so:
 
 $('#content div.thumb a').livequery('click', function(e) {
 alert ('clicked');
 e.preventDefault();
var href = $(this).attr('href');
$('#mainMenu ul li ul li a[href$=' + href +
 ']').triggerHandler
 ('click');
return false;
 });
 
 Safari, Firefox and Opera all show the alert when clicked. ie6 and
 ie7
 do not. In firebug, there are no errors. Any clues?
 
But are there any errors in IE?
 
--
Brandon Aaron



[jQuery] Re: Confirming submit using Validate plugin

2008-11-16 Thread Jörn Zaefferer

$(...).validate({
 rules: { ...},
 messages: { ... },
 submitHandler: function(form) {
  if (confirm(Really?) {
form.submit();
  }
 },
 otherStuff: ...,
  etc...
});

On Sun, Nov 16, 2008 at 10:09 PM, flycast [EMAIL PROTECTED] wrote:

 Thanks!

 I am having a hard time getting my form to validate now. Would I place
 my rules here?

 $(...).validate({
  submitHandler: function(form) {
   if (confirm(Really?)) {
 rules...
 messages...
 etc...
 form.submit();
   }else{
 //stuff to do if the form does not validate
  }
 }

 });


[jQuery] Anyone using flash in his cycle slides?

2008-11-16 Thread Tolis Christomanos
Hello group,

I have a problem with the cycle plugin and internet explorer. When i have a
slide (div) with flash inside it it keeps playing even when it is not
visible (display:none);

Any ideas?

Thanks in advance


[jQuery] Re: Pause after .load request

2008-11-16 Thread [EMAIL PROTECTED]

I've been trying to play around with this, my javascript knowledge is
very limit still (learning!).

I keep getting this error:

Error: useless setInterval call (missing quotes around argument?)

I changed the script after running it a bit, to try and fix the error,
still having problems:

$(document).ready(function() {

   var date_reg = $(input#date_requested).val();
   var counter = -1;
   slideTimer = setInterval((function(date_reg,counter){ //global var
  if (counter = date_reg) {
 $('#result').load('/get_time_lapse.pl',
{date_requested: date_reg});
 counter++;
 date_reg--;
   } else { clearInterval(slideTimer); }
   })(date_reg,counter),2000);

});


On Nov 16, 1:04 pm, ricardobeat [EMAIL PROTECTED] wrote:
 There is no 'delay' or 'pause' in Javascript, you have to use a
 timeout or interval. Maybe this will work (interval, vars passed with
 a closure, if instead of while):

 $(document).ready(function() {

    var date_reg = $(input#date_requested).val();
    var counter = -1;
    slideTimer = setInterval((function(date,counter){ //global var
       if (counter = date) {
          $('#result').load('/get_time_lapse.pl',
 {date_requested:date});
          counter++;
          date--;
        } else { clearInterval(slideTimer); }
    })(date_reg,counter),2000);

 });

 - ricardo

 On Nov 16, 3:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:

  Hello,

  I'm trying to fetch some data from a Perl script and have it begin to
  display as many times as there is data. More or less a data
  slideshow. The data is actually very visual, but at the moment, i dont
  want to implement a pause, forward/backward option, until I get the
  automatic option working.

  Basically what I'm trying to do is have the content load, wait, load,
  wait, etcWith a reasonable 2 - 3 seconds between each load...Here
  is the code I have that isn't quite working:

          $(document).ready(function() {
                  var date_reg = $(input#date_requested).val();
                  var counter = -1;
                  while (counter = date_reg)
                  {
                          $(#result).load('/get_time_lapse.pl', 
  {date_requested:
  date_reg});
                          counter = counter + 1;
                          date_reg = date_reg - 1;
                  }
          });

  where date_reg is just the number of times I want to load the screens.
  However, if I look at the logs for my Perl script, it does say all 10
  calls, immediately, as fast as it can. I've tried to put a javascript
  pause or whatever that function was called in here, but it doesnt seem
  to work.

  Any suggestions to implement a pause between each .load?

  Thanks


[jQuery] need some basic json object help

2008-11-16 Thread Geuis

I've gotten to be fairly intermediate at consuming json objects, such
as those I'm retrieving from web api's. However, I'm trying to push
the boundaries of what I understand about JSON objects once the client
has loaded them. I have been searching around google for the last
couple of hours for what I think I want to know but I'm getting
nowhere. Hoping some other js wizzes can help me out. This isn't
directly a jQuery question, but I need to understand more about this
to help me write better jQuery code.

This is my sample data for the following questions:
var obj = { nodes :[
{
type : 'a',
name : 'stuff'
},
{type : 'b'},
{type : 'c'}
  ]
};

1) How can I add new nodes to an existing object? I can reference
obj.nodes[x].type for example. Now I want to add a new type to
nodes. I tried: obj += {type:'d'}; but got nothing usable. Except
that obj.nodes.length went from 3 to 62.

2) Is there a list of core Javascript methods that let you work with
JSON objects? Something like .push, .pop, etc?

3) How do you search a JSON object? Suppose I want to find a group of
nodes that all have the name stuff, regardless of what their type
property is?
I know I can loop through an object using for(i in obj){}.


[jQuery] Re: Pause after .load request

2008-11-16 Thread ricardobeat

Ah, sorry. I made a mistake, this should work:

$(document).ready(function() {

   var date_reg = $(input#date_requested).val();
   var counter = -1;
   slideTimer = setInterval((function(date_reg,counter){
  return function(){ //global var
  if (counter = date_reg) {
 $('#result').load('/get_time_lapse.pl',
{date_requested: date_reg});
 counter++;
 date_reg--;
   } else { clearInterval(slideTimer); }
   };})(date_reg,counter),2000);

});

On Nov 16, 8:36 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 I've been trying to play around with this, my javascript knowledge is
 very limit still (learning!).

 I keep getting this error:

 Error: useless setInterval call (missing quotes around argument?)

 I changed the script after running it a bit, to try and fix the error,
 still having problems:

 $(document).ready(function() {

    var date_reg = $(input#date_requested).val();
    var counter = -1;
    slideTimer = setInterval((function(date_reg,counter){ //global var
       if (counter = date_reg) {
          $('#result').load('/get_time_lapse.pl',
 {date_requested: date_reg});
          counter++;
          date_reg--;
        } else { clearInterval(slideTimer); }
    })(date_reg,counter),2000);

 });

 On Nov 16, 1:04 pm, ricardobeat [EMAIL PROTECTED] wrote:

  There is no 'delay' or 'pause' in Javascript, you have to use a
  timeout or interval. Maybe this will work (interval, vars passed with
  a closure, if instead of while):

  $(document).ready(function() {

     var date_reg = $(input#date_requested).val();
     var counter = -1;
     slideTimer = setInterval((function(date,counter){ //global var
        if (counter = date) {
           $('#result').load('/get_time_lapse.pl',
  {date_requested:date});
           counter++;
           date--;
         } else { clearInterval(slideTimer); }
     })(date_reg,counter),2000);

  });

  - ricardo

  On Nov 16, 3:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

   Hello,

   I'm trying to fetch some data from a Perl script and have it begin to
   display as many times as there is data. More or less a data
   slideshow. The data is actually very visual, but at the moment, i dont
   want to implement a pause, forward/backward option, until I get the
   automatic option working.

   Basically what I'm trying to do is have the content load, wait, load,
   wait, etcWith a reasonable 2 - 3 seconds between each load...Here
   is the code I have that isn't quite working:

           $(document).ready(function() {
                   var date_reg = $(input#date_requested).val();
                   var counter = -1;
                   while (counter = date_reg)
                   {
                           $(#result).load('/get_time_lapse.pl', 
   {date_requested:
   date_reg});
                           counter = counter + 1;
                           date_reg = date_reg - 1;
                   }
           });

   where date_reg is just the number of times I want to load the screens.
   However, if I look at the logs for my Perl script, it does say all 10
   calls, immediately, as fast as it can. I've tried to put a javascript
   pause or whatever that function was called in here, but it doesnt seem
   to work.

   Any suggestions to implement a pause between each .load?

   Thanks


[jQuery] Re: Its possible to do this??

2008-11-16 Thread ricardobeat

That's not always right: in case you're going to reuse that main
selector a lot, it's better to make it a jQuery object so you don't
need to redo the first part of the query every time.

cheers,
- ricardo

On Nov 16, 6:27 pm, Jason Huck [EMAIL PROTECTED] wrote:
 If you want to concatenate strings in order to create selectors, don't
 make them jQuery objects first. In other words, just do this:

     var row = .flexigrid .bDiv #socios .trSelected:first;
     $(row +  td:first).css(color, red);

 Also, as long as your ID's are unique, which they should be, there's
 no need to put anything in front of them in your selector, so you
 should be able to shorten it like so:

     var row = #socios.trSelected:first;
     $(row +  td:first).css(color, red);

 HTH,
 Jason

 On Nov 16, 11:30 am, SoutlinK [EMAIL PROTECTED] wrote:

  Hi.

  I am new with jQuery, and i want to know if its possible to do the
  follow.

  var row = $(.flexigrid .bDiv #socios .trSelected:first);
  $(row +  td:first).css(color, red);

  Or something like that.

  I mean.

  I have a row selected in jQuery. Now I want to go for each column, of
  this row without do this
  var col0 = $(.flexigrid .bDiv #socios .trSelected:first td:eq(0));

  Thanks


[jQuery] Convert from mootools to jquery

2008-11-16 Thread gus

Hi i want to know if this code can be converted to jquery. It's a very
good hoover pop up with effect code.



function initCloseButton(){
var blocks = document.getElementsByTagName(li);
for (var i=0; iblocks.length; i++){
if (blocks[i].className.indexOf(roll) != -1){
if ( blocks[i].className.indexOf(close) == -1 ) blocks
[i].className +=  close;
var links = blocks[i].getElementsByTagName(a);
for (var k=0; klinks.length; k++) {
if (links[k].className == button) {
links[k].onclick = function()   {
if ( 
this.parentNode.className.indexOf(close) != -1 ){

this.parentNode.className = this.parentNode.className.replace
(close, );
}
else{

this.parentNode.className +=  close;
}
return false;
}
}
}
}
}
}
var _timer;
function initMSDropDown(){
$$('.home-page .top-block ul li').each(function(el, i){
if ($(el).getElement('.sub-nav')){
el._div = $(el).getElement('.sub-nav');
el._h = $(el._div).getStyle('height').toInt();
el._w = $(el._div).getStyle('width').toInt();
el._i = i;
$(el._div).setStyle('height', 0);
$(el._div).setStyle('width', 0);
el.onmouseover = function(){
if (_timer) clearTimeout(_timer);
startEffect(this);
}
el.onmouseout = function(){
_timer = setTimeout(disposeDivs(), 100);
}
}

});
disposeDivs();
}
function startEffect(elem){
if ($$('.sub-nav').length){
$$('.sub-nav').each(function(des, i){
$(des).setStyle('visibility', 'visible');
});
return;
}
if (elem._div){
var _border = new Element('div', {'class': 'sub-nav', 'styles':{
'border':'1px solid #B8B8B8',
'background':'none',
'height': '15px',
'width': '5px',
'right': 0,
'visibility': 'visible'
}}).inject(elem);
_border.moo = new Fx.Morph($(_border), {duration:100,
onComplete: function(){

$(elem._div).getElements('*').setStyle('opacity', 1);
_border.innerHTML = elem._div.innerHTML;
$(_border).setStyle('background', '#FF');
}
});
_border.moo.start({'height': elem._h, 'width': elem._w});
}
}
function disposeDivs(){
$$('.sub-nav').each(function(des, i){
$(des).getElements('*').setStyle('opacity', 0);
$(des).setStyle('background', 'none');
des.moo = new Fx.Morph($(des), {duration:100,
onComplete: function(){
$(des).dispose();
}
});
des.moo.start({'height': 15, 'width': 5});
});
}
function initPage(){
initCloseButton();
initMSDropDown();
}
if (window.addEventListener){
window.addEventListener(load, initPage, false);
}
else if (window.attachEvent){
window.attachEvent(onload, initPage);
}


[jQuery] ajax error handling troubles

2008-11-16 Thread Davide

$.ajax({
async: true,
url: testingURL,
success: function () {
location.reload();
},
error: function (XMLHttpRequest, textStatus, 
errorThrown) {
console.log('error throw');
console.log(errorThrown);
}
});

the requested page can return  404 or 403 error codes
but the errorThrown variable is ALWAYS undef...
any idea ??


[jQuery] Validate. CheckBoxes

2008-11-16 Thread shapper

Hello,

I have a list of CheckBoxes: A, B, C, D and E.

A, B and C should obey a relation that only one of this three can be
selected.

So I select A and D and then C, A will be unchecked. D and E don't
have any relation.

Does anyone knows a plugin that does this?

Thanks,
Miguel


[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Karl Rudd

The documentation for the ajax error function has this note in the example:

  // typically only one of textStatus or errorThrown
  // will have info

( http://docs.jquery.com/Ajax/jQuery.ajax#toptions )

Perhaps check the textStatus as well as the errorThrown?

Karl Rudd

On Mon, Nov 17, 2008 at 10:03 AM, Davide [EMAIL PROTECTED] wrote:

$.ajax({
async: true,
url: testingURL,
success: function () {
location.reload();
},
error: function (XMLHttpRequest, textStatus, 
 errorThrown) {
console.log('error throw');
console.log(errorThrown);
}
});

 the requested page can return  404 or 403 error codes
 but the errorThrown variable is ALWAYS undef...
 any idea ??



[jQuery] Unit Testable jQuery plugins

2008-11-16 Thread Anup

Hi,

A little while back I wrote a post on writing unit testable jQuery
plugins:

http://www.onenaught.com/posts/85/jquery-tip-to-increase-plugin-flexibility-and-testability

I am finding more and more that jQuery code I write can often be
turned into plugins. Furthermore, those plugins can be unit tested,
and on top of that, writing unit tests helps me drive out better
functionality because of the need to write testable code.

Comments, improvements etc welcome!

Regards,
Anup Shah
http://www.onenaught.com


[jQuery] Re: Its possible to do this??

2008-11-16 Thread Kean

Let me see. I would try the following

var row = $(.flexigrid .bDiv #socios .trSelected:first);

1. $(row).find(td:first-child).css(color, red);
2. row.find(td:first-child).css(color, red);

3.
$(row).each(function(){
   $(this).find(td:first-child).css('color', 'red');
});


4.
$(row).each(function(){
   $(this).find(td:eq(0)).css('color', 'red');
});

5. $('td:first-child', row).css('color', 'red');

6. $(.flexigrid .bDiv #socios .trSelected:first td:first-child);

7 . $(row).find(td:nth-child(1)).css(color, red);

8.  row.find(td:nth-child(1)).css(color, red);

9.
$(row).each(function(){
   $(this).find(td:nth-child(1)).css('color', 'red');
});

Well, I don't recommend
:first and eq(0)   this means well from the bunch of DOM
nodes I get, return the first one

instead consider using
:first-child and nth-child -- this mean well from the bunch
of DOM nodes I get, return those who are the first child of their
parent

There are many ways to do this and choose the one that's the least
expensive, meaning :first or eq(0) might be used depending of the
circumstances

On Nov 16, 8:30 am, SoutlinK [EMAIL PROTECTED] wrote:
 Hi.

 I am new with jQuery, and i want to know if its possible to do the
 follow.

 var row = $(.flexigrid .bDiv #socios .trSelected:first);
 $(row +  td:first).css(color, red);

 Or something like that.

 I mean.

 I have a row selected in jQuery. Now I want to go for each column, of
 this row without do this
 var col0 = $(.flexigrid .bDiv #socios .trSelected:first td:eq(0));

 Thanks


[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Mike Alsup

                 $.ajax({
                         async: true,
                         url: testingURL,
                         success: function () {
                                 location.reload();
                         },
                         error: function (XMLHttpRequest, textStatus, 
 errorThrown) {
                                 console.log('error throw');
                                 console.log(errorThrown);
                         }
                 });

 the requested page can return  404 or 403 error codes
 but the errorThrown variable is ALWAYS undef...
 any idea ??

errorThrown is for JavaScript errors (think try/catch).  40X responses
are not thrown, they are just errors returned from the server and
you can get details from the xhr (ie: xhr.statusText).

Mike



[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Mike Alsup

 errorThrown is for JavaScript errors (think try/catch).  40X responses
 are not thrown, they are just errors returned from the server and
 you can get details from the xhr (ie: xhr.statusText).

To elaborate slightly, the server could return an XML document with a
200 status code.  But if the browser can not parse the document a
parseerror will occur and jQuery's error handler will be invoked.  In
that case the errorThrown argument will not be undefined.


[jQuery] Re: need some basic json object help

2008-11-16 Thread RobG



On Nov 17, 8:57 am, Geuis [EMAIL PROTECTED] wrote:
 I've gotten to be fairly intermediate at consuming json objects, such
 as those I'm retrieving from web api's. However, I'm trying to push
 the boundaries of what I understand about JSON objects once the client
 has loaded them. I have been searching around google for the last
 couple of hours for what I think I want to know but I'm getting
 nowhere. Hoping some other js wizzes can help me out. This isn't
 directly a jQuery question, but I need to understand more about this
 to help me write better jQuery code.

 This is my sample data for the following questions:
         var obj = {     nodes :[
                                 {
                                         type : 'a',
                                         name : 'stuff'
                                 },
                                 {type : 'b'},
                                 {type : 'c'}
                           ]
         };

 1) How can I add new nodes to an existing object? I can reference
 obj.nodes[x].type for example. Now I want to add a new type to
 nodes. I tried: obj += {type:'d'}; but got nothing usable. Except
 that obj.nodes.length went from 3 to 62.


  obj.nodes.push({type:'d'});


 2) Is there a list of core Javascript methods that let you work with
 JSON objects? Something like .push, .pop, etc?

Methods belong to objects, the methods you mention belong to
Array.prototype and therefore instances of Array.


 3) How do you search a JSON object? Suppose I want to find a group of
 nodes that all have the name stuff, regardless of what their type
 property is?
 I know I can loop through an object using for(i in obj){}.

Since nodes is an array, you can iterate over it using a for loop (or
an each method) and check:

  var t = nodes[i];
  var stuffGroup = [];
  if ( t.name  t.name == 'stuff' ) {
stuffGroup.push(t);
  }

You might want to make the relevant methods properties of some object
that you construct and pass it the JSON data to work with.


--
Rob


[jQuery] Re: need some basic json object help

2008-11-16 Thread Geuis

Thanks for the tips. That helps a bunch.

On Nov 16, 6:27 pm, RobG [EMAIL PROTECTED] wrote:
 On Nov 17, 8:57 am, Geuis [EMAIL PROTECTED] wrote:



  I've gotten to be fairly intermediate at consuming json objects, such
  as those I'm retrieving from web api's. However, I'm trying to push
  the boundaries of what I understand about JSON objects once the client
  has loaded them. I have been searching around google for the last
  couple of hours for what I think I want to know but I'm getting
  nowhere. Hoping some other js wizzes can help me out. This isn't
  directly a jQuery question, but I need to understand more about this
  to help me write better jQuery code.

  This is my sample data for the following questions:
          var obj = {     nodes :[
                                  {
                                          type : 'a',
                                          name : 'stuff'
                                  },
                                  {type : 'b'},
                                  {type : 'c'}
                            ]
          };

  1) How can I add new nodes to an existing object? I can reference
  obj.nodes[x].type for example. Now I want to add a new type to
  nodes. I tried: obj += {type:'d'}; but got nothing usable. Except
  that obj.nodes.length went from 3 to 62.

   obj.nodes.push({type:'d'});

  2) Is there a list of core Javascript methods that let you work with
  JSON objects? Something like .push, .pop, etc?

 Methods belong to objects, the methods you mention belong to
 Array.prototype and therefore instances of Array.

  3) How do you search a JSON object? Suppose I want to find a group of
  nodes that all have the name stuff, regardless of what their type
  property is?
  I know I can loop through an object using for(i in obj){}.

 Since nodes is an array, you can iterate over it using a for loop (or
 an each method) and check:

   var t = nodes[i];
   var stuffGroup = [];
   if ( t.name  t.name == 'stuff' ) {
     stuffGroup.push(t);
   }

 You might want to make the relevant methods properties of some object
 that you construct and pass it the JSON data to work with.

 --
 Rob


[jQuery] Question about [Autocomplete]

2008-11-16 Thread MeanStudios

Greetings,

I am using this plugin in my web application and I had a quick
question.  Is there a way to trigger an ajax call if someone selects
something from the dropdown list? The ajax call would then fill in
some fields below related to what was just selected from the
autocomplete field.

Thank you for your time,
cody


[jQuery] Re: image toggle

2008-11-16 Thread bob

Cannot be done something with each?
Again, it does not work for me.

var menu = ['home','news','sport','music'];

$.each(menu, function(index) {

$('#'+this+'_header').click(function(){
alert(this+'_header clicked');

});

});