[jQuery] Re: Is there a way to determine the scrollTop position of the top of the viewport?

2009-08-11 Thread Richard D. Worth
var scrollTop = $(window).scrollTop();
- Richard

On Mon, Aug 10, 2009 at 9:28 PM, Rick Faircloth r...@whitestonemedia.comwrote:

  I’m trying to position a div that’s used as a modal window 50px from the
 top of the

 current viewport, no matter where the page currently is scrolled to.



 I found “getScrollTop();”, but couldn’t make that work.



 I checked out jQuery’s “scrollTop”, but that get the y position or offset
 of a matched

 element.



 Suggestions on how to dynamically calculate this?



 Thanks,



 Rick




 --

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





[jQuery] Re: Best cookie plug-in?

2009-08-11 Thread ldexterldesign

Cheers Jack. I'll check it out.

Best,
L

On Aug 9, 7:09 pm, Jack Killpatrick j...@ihwy.com wrote:
 I've used this with success:

 http://plugins.jquery.com/project/cookie

 - Jack

 ldexterldesignwrote:
  Easy guys,

  Just getting started with cookies this afternoon and wondering what
  plug-in everyone is using these days?

  Thanks,
  L


[jQuery] How to get variable from iframe?

2009-08-11 Thread David .Wu

a.php
iframe src=b.php/iframe
..
script
var a = 123;
/script

Can I catch variable a in b.php?



[jQuery] Re: refactoring help/ suggestions?

2009-08-11 Thread Ricardo

if (par.is(:hidden))
  par.fadeIn(slow);
else
 par.fadeOut(sloe);

can be replaced with

par.toggle('slow');

:]

On Aug 10, 8:33 pm, Jules jwira...@gmail.com wrote:
 Assuming your html format as follows:

     a href=# class=pPara a/a
     pParagraph a/p
     br /
     a href=# class=pPara b/a
     pParagraph b/p
     br /
     a href=# class=pPara c/a
     pParagraph c/p

 Use this:
         $(document).ready(function() {
             $(a.p).next(p).hide();

             $(a.p).hover(function() {
                 $(this).fadeOut(slow).fadeIn(slow);
                 var par = $(this).next(p);

                 if (par.is(:hidden))
                     par.fadeIn(slow);
                 else
                     par.fadeOut(sloe);
             });
         });

 On Aug 11, 3:52 am, Calvin cstephe...@gmail.com wrote:

  Here is a solution I came up with, but there is still some repeated
  code. Does anyone have any suggestions I could try out to 'DRY' up my
  code?

  jQuery.fn.swapFade = function() {
          if (this.is(':hidden')) {
                  this.fadeIn('slow');
                  } else {
                  this.fadeOut('slow');
                  }

  };

    $(document).ready(function() {
          $('p.a, p.b, p.c').hide();
          var hash = {'one': 'a', 'two': 'b', 'three': 'c'}

          $('.one').hover(function() {
          $('a.one').fadeOut('slow').fadeIn('slow');
      $('p.' + hash[this.className]).swapFade();

          return false;
          });

          $('.two').hover(function() {
          $('a.two').fadeOut('slow').fadeIn('slow');
      $('p.' + hash[this.className]).swapFade();

          return false;
          });

          $('.three').hover(function() {
          $('a.three').fadeOut('slow').fadeIn('slow');
      $('p.' + hash[this.className]).swapFade();

          return false;
          });

  });

  On Aug 9, 11:51 am, Calvin cstephe...@gmail.com wrote:

   Hi,

   I wrote this code for a simple hide and show effect and I am looking
   for any advice or examples of how I can refactor the code. I tried
   using a hash but it didn't work out right and I am thinking that maybe
   I should make a object method.

   here is the code:

   $(document).ready(function() {
     var $firstPara = $('p.a');
      $firstPara.hide();

     $('a.one').hover(function() {
      $('a.one').fadeOut('slow').fadeIn('slow');

      if ($firstPara.is(':hidden')) {
          $firstPara.fadeIn('slow');
      } else {
         $firstPara.fadeOut('slow');
      }
           return false;

   });
   });

   $(document).ready(function() {
     var $secondPara = $('p.b');
      $secondPara.hide();

     $('a.two').hover(function() {
      $('a.two').fadeOut('slow').fadeIn('slow');

      if ($secondPara.is(':hidden')) {
          $secondPara.fadeIn('slow');
      } else {
         $secondPara.fadeOut('slow');
      }
           return false;

   });
   });

   $(document).ready(function() {
     var $thirdPara = $('p.c');
      $thirdPara.hide();

     $('a.three').hover(function() {
      $('a.three').fadeOut('slow').fadeIn('slow');

      if ($thirdPara.is(':hidden')) {
          $thirdPara.fadeIn('slow');
      } else {
         $thirdPara.fadeOut('slow');
      }
           return false;

   });
   });


[jQuery] Re: AJAX calls acting syncronously

2009-08-11 Thread sak


Thats the thing, I don't want the results coming back in order. I am
trying emulate them coming back unordered, but they are coming back
ordered. I was digging deeper yesterday and discovered the results are
linked to an aspsessionid cookie that is created from the asp pages
(don't fully understand it yet) but through elimination I determined
if I delete this cookie everytime it is generated, then the AJAX calls
behave normally - the calls work asyncronously. If the cookie exists
then the AJAX calls act syncronously which is not what I want. If
anybody has any experience in this.

On Aug 10, 2:32 pm, MorningZ morni...@gmail.com wrote:
 Am I missing something here

 Yes, you are assuming that the results will come back in the order
 called, which totally is not the case the success function simply
 says when you return from this async call, run this, there is
 nothing in the logic about order

 There is an older plugin that could be used Ajax Queue 
 (http://www.google.com/search?q=ajax+queue), or you can adjust your code
 accordingly

 On Aug 10, 8:34 am, sak saks...@gmail.com wrote:

  Hi there

  I am a newbie to using jquery and have been exploring it developing a
  new app. At the moment I have a number of AJAX calls to the server
  which I have been queueing in an array and using a single $.ajax call
  to handle all of them. However I know about the browser limitations of
  two calls per page (at the same time and want to implement this to
  speed up page updating). To test concurrent ajax requests I have setup
  various asp pages to with delays 1sec, 5sec, 10sec etc etc. and a test
  html file with the follwing javascript

  $('#btn1', '#divTest').click(function(event){
    $.ajax({
          url: 'include/asp/test/one_secs.asp',
          type: 'GET',
          cache: 'false',
          processData: false,
          success: function(data, txtStatus) {
                  alert(data);
          },
     });});

  $('#btn10', '#divTest').click(function(event){
   $.ajax({
          url: 'include/asp/test/ten_secs.asp',
          type: 'GET',
          cache: 'false',
          processData: false,
          success: function(data, txtStatus) {
                   alert(data);
          },
    });

  });

  so now when I click on btn1 it returns the call after 1sec as it
  should, and the 10sec button after 10 seconds all good. When I click
  the 10 seconds first, quickly followed by the 1second button I expect
  the 1second to return first followed by the 10 second...

  This doesn't happen it still processes the 10second first and returns
  the 1second after the 10second is finished.

  Am I missing something here I have seen something in other forums
  that suggest it may be server related (server queuing the
  requests) ?

  Also I apologise if this has been discussed before (I have been
  searching all morning for a solution), buthaven't found anything..

  any help would be brilliant


[jQuery] Re: animate image position

2009-08-11 Thread Tom Cool

Hey Paul,

Thanks for the quick reply. Due to legal issues i can't give you an
example or demo page i am afraid.
I am very curious to what others have experienced during development
of related animations.
It is simply animating a large image (500x500 - reduced res) from left
to right (380px).

Please, any ideas.

Tom

On Aug 10, 10:35 pm, Paul Mills paul.f.mi...@gmail.com wrote:
 Hi,
 Can you post an example of your animation code or link to a demo page.

 Paul

 On Aug 10, 4:39 pm, Tom Cool tomcoo...@gmail.com wrote:

  Hi,

  I'm experiencing a large amount of flickering in a image i move with
  animate(). Looking at jQuery's source code, i think it has something
  to do with the setInterval it uses to calculate the animation; when
  binding the animation to 'mousemove' its runs smoothly.

  Any ideas on how to improve this animation?

  Thanks,
  Tom.


[jQuery] Add extra content to the title attribute

2009-08-11 Thread Paul Collins
Hi all,
This is hopefully simple. I have a bunch of links with titles, like
TITLE=Facebook and so on. I am adding JQuery to make the links open in a
new window and would like to add some text to the title that says this link
will open in a new window, whilst keeping the original text. I'm using the
add JQuery command, but this actually replaces the original title text.

$(a.newWindow).attr(title,  - This link will open in a new window);

The end result I would like to have is: title=Facebook - This link will
open in a new window.

Could anyone point me in the right direction?!
Cheers


[jQuery] Re: Problem on IE8

2009-08-11 Thread Liam Byrne


If there's no CSS value explicitly set, then the different browsers will 
default to different default settings.


There's no point in allowing users to change their CSS if it means that 
your website doesn't work.


L

Gaiz wrote:

User that use my website can customize CSS.
I do not know why it error on IE8 only (IE7, FF is work fine)


On Aug 11, 2:26 am, Liam Byrne l...@onsight.ie wrote:
  

How are you setting the border in CSS ?

If you set it explicitly, it should work cross-browser

L



Gaiz wrote:


I found 2 problems when I use jQuery onIE8
  
1. When I use $('elementId').css('border-top-width'), it return

medium, but other browsers return 0px
2. After domready, my page, that's a widget, call ajax to load
content. On page, it have menu link to call ajax to load value.
I debug and found no any response from ajax call.
  
Anyone have suggestion?


  
No virus found in this incoming message.

Checked by AVG -www.avg.com
Version: 8.5.392 / Virus Database: 270.13.49/2294 - Release Date: 08/10/09 
06:10:00



No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.50/2296 - Release Date: 08/11/09 06:10:00


  




[jQuery] Re: Add extra content to the title attribute

2009-08-11 Thread Liam Potter


something like this

var origTitle = $(a.newWindow).attr(title);
$(a.newWindow).attr(title, origTitle+ - This link will open in a 
new window);


Paul Collins wrote:

Hi all,

This is hopefully simple. I have a bunch of links with titles, like 
TITLE=Facebook and so on. I am adding JQuery to make the links open 
in a new window and would like to add some text to the title that says 
this link will open in a new window, whilst keeping the original 
text. I'm using the add JQuery command, but this actually replaces 
the original title text.


$(a.newWindow).attr(title,  - This link will open in a new window);

The end result I would like to have is: title=Facebook - This link 
will open in a new window. 


Could anyone point me in the right direction?!
Cheers





[jQuery] Re: Add extra content to the title attribute

2009-08-11 Thread Liam Byrne


Paul Collins wrote:

 I'm using the add JQuery command,
 $(a.newWindow).attr(title,  - This link will open in a new window);

I can't see any add there ?

The proper code would be 
$(a.newWindow).attr(title,$(this).attr(title)+ - This link will 
open in a new window);


L

Paul Collins wrote:

Hi all,

This is hopefully simple. I have a bunch of links with titles, like 
TITLE=Facebook and so on. I am adding JQuery to make the links open 
in a new window and would like to add some text to the title that says 
this link will open in a new window, whilst keeping the original 
text. I'm using the add JQuery command, but this actually replaces 
the original title text.


$(a.newWindow).attr(title,  - This link will open in a new window);

The end result I would like to have is: title=Facebook - This link 
will open in a new window. 


Could anyone point me in the right direction?!
Cheers




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.50/2296 - Release Date: 08/11/09 06:10:00


  




[jQuery] Re: Add extra content to the title attribute

2009-08-11 Thread Peter Edwards
try this:

$(a.newWindow).attr(title, $(a.newWindow).attr(title)+ - This link
will open in a new window);

On Tue, Aug 11, 2009 at 10:45 AM, Paul Collins pauldcoll...@gmail.comwrote:

 Hi all,
 This is hopefully simple. I have a bunch of links with titles, like
 TITLE=Facebook and so on. I am adding JQuery to make the links open in a
 new window and would like to add some text to the title that says this link
 will open in a new window, whilst keeping the original text. I'm using the
 add JQuery command, but this actually replaces the original title text.

 $(a.newWindow).attr(title,  - This link will open in a new window);

 The end result I would like to have is: title=Facebook - This link will
 open in a new window.

 Could anyone point me in the right direction?!
 Cheers




[jQuery] Re: $ajax() question

2009-08-11 Thread Jules

After re-reading the original post, it seems json is not required

just use
data:Args=+args2

on the server side

StreamReader reader = new StreamReader(Request.InputStream);

string param = reader.ReadToEnd();

param = Args=abc assuming args2=abc

Just use split() to get the value.

On Aug 11, 1:59 pm, Jules jwira...@gmail.com wrote:
 JavaScriptSerializer is included in AJAX 1.0. It is compatible
 with .NET 2.0.

 http://www.asp.net/ajax/downloads/archive/

 You don't have to use the ajax component on your client to use it.

 On Aug 11, 1:18 pm, yi falconh...@gmail.com wrote:

  Hi Jules:
  If i use old version of ASP.net, Can i Deserialize Json data?

  thanks Jules!!!

  On Aug 11, 3:01 pm, Jules jwira...@gmail.com wrote:

   Opps,
   You are right, change the contentType to

   contentType: application/json; charset=utf-8

   here is a snippet to handle generic json in C# .NET 3.5

   JavaScriptSerializer ser = new JavaScriptSerializer();
   StreamReader reader = new StreamReader(Request.InputStream);
   object input = ser.DeserializeObject(reader.ReadToEnd());
   string args = ((Dictionarystring, object)input)[Args] as string;

   or if you have the object defined use

   System.Runtime.Serialization.Json.DataContractJsonSerializer

   More info in

  http://www.west-wind.com/WebLog/posts/218001.aspx

   On Aug 11, 12:23 pm, yi falconh...@gmail.com wrote:

hi Jules:
I use Request(Arg) , but it doesn't work. it always give me empty
string
contentType: text is it right?
do i need make it  contentType: Json,  ?
If i need use JSON, do you know how to read json data at sever side in
asp.net?
thanks so much!!!

On Aug 11, 12:50 pm, Jules jwira...@gmail.com wrote:

 Use Request(Arg) instead, this syntax gets the Arg from data post or
 querystring.
 Do not enclose args2, the server will get args2 instead of the value
 of args2.

 data:{Arg:args2}

 On Aug 11, 10:12 am, yi falconh...@gmail.com wrote:

  Hi Jules:
  thank you for your help!!
  if I use this:

  type: POST,
  url: mywebpage.aspx,
  data:{Arg:args2}

  Do you know how can i get value of arg from sever side(code 
  behind)? I
  use asp.net, but i dont know how to fatch data when data put inside
  {},  data:{Arg:args2} 
  Can i still use Request.QueryString() function?

  thanks

  On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote:

   There is a limit on url length depending on the browser.

  http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g...

   use type:POST and data: instead and do not enclose the object
   declaration

   data:{Arg:args2} instead of  data:{Arg:args2}

   On Aug 11, 8:41 am, yi falconh...@gmail.com wrote:

$.ajax({

                                        type: POST,

                                        url: mywebpage.aspx?
Arg=+args2,

                                        contentType: text,

                                        data:{},

                                        dataType: text,

                                        success: CompleteInsert,

                                        error: onFail

                                });

I dont know why the onFail function is going to be executed 
when args2
is too big.
args2 is a string type
can anyone explain this
thanks


[jQuery] Re: HTML5 video tag available?

2009-08-11 Thread quiKe

Hi again.

But i insert the video tag into the code:

for (var j = 0; j  bloque.video.length; j++) {
Bloque += 'li id=' + j + ' video src=' +
bloque.video[j].ruta + ' alt=' + bloque.video[j].alt + '
controls=' + bloque.video[j].controls + '  autoplay=' + bloque.video
[j].autoplay + ' //li';
}

So the video tag is in the DOM. The problem is jquery doesn´t
recognize the tag, so you can not control it as a img tag for example
(for searchs, manipulation...). Any idea to how to do it?.

Thanks.



On Aug 7, 3:30 pm, Liam Potter radioactiv...@gmail.com wrote:
 try adding

 document.createElement(video);

 before your jquery script

 quiKe wrote:
  tried (doesn´t work) but i wanted to know if maybe i was on a mistake.

  On Aug 7, 12:52 pm, Liam Potter radioactiv...@gmail.com wrote:

  try it?

  quiKe wrote:

  Hi, do you know if it is possible to use selectors for a video tag?
  For example:
  $(this).find('div.misc').find('ul').addClass('thumb-fila').find
  ('li').find('video').each(function(){
  });

  to capture the video tags on a li?

  Thanks


[jQuery] Re: Is there a way to determine the scrollTop position of the top of the viewport?

2009-08-11 Thread Rick Faircloth
Hi, Richard, and thanks for the reply.

 

I had tried that very approach with this line:

 

var scrollTopPosition = $(window).scrollTop();

 

but when I run the code (full code below), I get

an error in Firebug that $(window).scrollTop(); is not a function

 

Well.I just found the answer.  I was using an older version of jQuery

that I have in a misc folder for code tests.  Apparently .scrollTop();

wasn't a function in that version.

 

Thanks for verifying an approach I took, causing me to dig harder

for the answer!

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Richard D. Worth
Sent: Tuesday, August 11, 2009 2:14 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is there a way to determine the scrollTop position of
the top of the viewport?

 

var scrollTop = $(window).scrollTop();

 

- Richard

On Mon, Aug 10, 2009 at 9:28 PM, Rick Faircloth r...@whitestonemedia.com
wrote:

I'm trying to position a div that's used as a modal window 50px from the top
of the

current viewport, no matter where the page currently is scrolled to.

 

I found getScrollTop();, but couldn't make that work.

 

I checked out jQuery's scrollTop, but that get the y position or offset of
a matched

element.

 

Suggestions on how to dynamically calculate this?

 

Thanks,

 

Rick

 


--

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

 

 



[jQuery] Re: AJAX calls acting syncronously

2009-08-11 Thread Nick Fitzsimons

2009/8/11 sak saks...@gmail.com:


 Thats the thing, I don't want the results coming back in order. I am
 trying emulate them coming back unordered, but they are coming back
 ordered. I was digging deeper yesterday and discovered the results are
 linked to an aspsessionid cookie that is created from the asp pages
 (don't fully understand it yet) but through elimination I determined
 if I delete this cookie everytime it is generated, then the AJAX calls
 behave normally - the calls work asyncronously. If the cookie exists
 then the AJAX calls act syncronously which is not what I want. If
 anybody has any experience in this.


I assume you're using Classic ASP rather than ASP.NET? If so, the
reason your first (10s) call delays the response to the second (1s) is
that ASP's session tracking is enabled by default, and its session
object does not support concurrent access by multiple threads. Thus,
when the server starts a thread to handle the second (1s) request,
that thread is blocked waiting for the session object associated with
your client (via the session cookie) to be released by the first (10s)
request's thread. So this is just an effect of a limitation in the
server-side technology, and nothing to do with the browser or jQuery.

You can disable session tracking for your tests using the
@ENABLESESSIONSTATE directive:
http://msdn.microsoft.com/en-us/library/ms525847.aspx.

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/


[jQuery] Re: refactoring help/ suggestions?

2009-08-11 Thread Karl Swedberg


On Aug 11, 2009, at 3:31 AM, Ricardo wrote:



if (par.is(:hidden))
 par.fadeIn(slow);
else
par.fadeOut(sloe);

can be replaced with

par.toggle('slow');

:]


While that's true, .toggle('slow') does more than just fade in and  
out. It animates the width and the height as well.


Calvin,

Here is one other way to make it more DRY (untested), assuming I  
understand correctly what you're trying to achieve:


jQuery.fn.swapFade = function(speed, easing, callback) {
  return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

$(document).ready(function() {
  $('p.a, p.b, p.c').hide();
  var hash = {'one': 'a', 'two': 'b', 'three': 'c'}


  $('.one, .two, .three').hover(function() {
$('a.' + this.className).fadeOut('slow').fadeIn('slow');
$('p.' + hash[this.className]).swapFade();

return false;
  });
});


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Aug 10, 8:33 pm, Jules jwira...@gmail.com wrote:

Assuming your html format as follows:

a href=# class=pPara a/a
pParagraph a/p
br /
a href=# class=pPara b/a
pParagraph b/p
br /
a href=# class=pPara c/a
pParagraph c/p

Use this:
$(document).ready(function() {
$(a.p).next(p).hide();

$(a.p).hover(function() {
$(this).fadeOut(slow).fadeIn(slow);
var par = $(this).next(p);

if (par.is(:hidden))
par.fadeIn(slow);
else
par.fadeOut(sloe);
});
});

On Aug 11, 3:52 am, Calvin cstephe...@gmail.com wrote:


Here is a solution I came up with, but there is still some repeated
code. Does anyone have any suggestions I could try out to 'DRY' up  
my

code?



jQuery.fn.swapFade = function() {
if (this.is(':hidden')) {
this.fadeIn('slow');
} else {
this.fadeOut('slow');
}



};



  $(document).ready(function() {
$('p.a, p.b, p.c').hide();
var hash = {'one': 'a', 'two': 'b', 'three': 'c'}



$('.one').hover(function() {
$('a.one').fadeOut('slow').fadeIn('slow');
$('p.' + hash[this.className]).swapFade();



return false;
});



$('.two').hover(function() {
$('a.two').fadeOut('slow').fadeIn('slow');
$('p.' + hash[this.className]).swapFade();



return false;
});



$('.three').hover(function() {
$('a.three').fadeOut('slow').fadeIn('slow');
$('p.' + hash[this.className]).swapFade();



return false;
});



});



On Aug 9, 11:51 am, Calvin cstephe...@gmail.com wrote:



Hi,


I wrote this code for a simple hide and show effect and I am  
looking

for any advice or examples of how I can refactor the code. I tried
using a hash but it didn't work out right and I am thinking that  
maybe

I should make a object method.



here is the code:



$(document).ready(function() {
  var $firstPara = $('p.a');
   $firstPara.hide();



  $('a.one').hover(function() {
   $('a.one').fadeOut('slow').fadeIn('slow');



   if ($firstPara.is(':hidden')) {
   $firstPara.fadeIn('slow');
   } else {
  $firstPara.fadeOut('slow');
   }
return false;



});
});



$(document).ready(function() {
  var $secondPara = $('p.b');
   $secondPara.hide();



  $('a.two').hover(function() {
   $('a.two').fadeOut('slow').fadeIn('slow');



   if ($secondPara.is(':hidden')) {
   $secondPara.fadeIn('slow');
   } else {
  $secondPara.fadeOut('slow');
   }
return false;



});
});



$(document).ready(function() {
  var $thirdPara = $('p.c');
   $thirdPara.hide();



  $('a.three').hover(function() {
   $('a.three').fadeOut('slow').fadeIn('slow');



   if ($thirdPara.is(':hidden')) {
   $thirdPara.fadeIn('slow');
   } else {
  $thirdPara.fadeOut('slow');
   }
return false;



});
});




[jQuery] Expression vs. selector

2009-08-11 Thread André Hänsel

Hi,

in the docs there are methods accepting arguments of type
Expression (filter,...) and methods accepting
Selector (appendTo,...)

To me it looks as if they were used interchangeable. So what is an
Expression in contrast to a Selector?

Regards,
André


[jQuery] Re: jqGrid 35.5 released

2009-08-11 Thread Brett Ryan

Hi Tony, somethings up with triand.com, it keeps reporting that the
account has been banned!

Hope all is okay, you've done some great work.
-Brett

On Aug 2, 5:23 am, Tony t...@trirand.com wrote:
 Happy to announce the final 3.5 release of jqGrid.
 New wiki Documentation athttp://www.trirand.com/jqgridwiki
 The demo athttp://www.trirand.com/jqgrid/jqgrid.html
 and final the home :http://www.trirand.com/blog

 Enjoy
 Tony


[jQuery] How to bind event handlers to elements

2009-08-11 Thread André Hänsel

Hi list,

which is the recommended way to bind event handlers to elements.
Preferably without giving each of them an id.

As far as I know, the classic way (input onchange=...) is
considered deprecated and evil. So what is the jQuery way of doing
this?

Regards,
André


[jQuery] malsup's form plugin

2009-08-11 Thread Saliem

Hello all --

How does wrapping a json response from the server in textarea tags
help following a file upload?



[jQuery] Re: scrolling height of the window and placing popup windows

2009-08-11 Thread mrphp

Did you manage to do it?

looking forward to hear from you soon.

On Jul 15, 5:56 pm, snitch maximilian.mut...@googlemail.com wrote:
 Hello,

 for opening a PopUp Window I use the Popup.js from Adrian yEnS Mato
 Gondelle.
 Adrian has written a function to center the popup by calculating the
 window height/with and popup width/height as well ans putting the
 coord in the middle of these coordinates. Like this:

 function centerPopup(){
         //request data for centering
         var windowWidth = document.documentElement.clientWidth;
         var windowHeight = document.documentElement.clientHeight;
         var popupHeight = $(#popupContact).height();
         var popupWidth = $(#popupContact).width();
         //centering
         $(#popupContact).css({
                 position: absolute,
                 top: windowHeight/2-popupHeight/2,
                 left: windowWidth/2-popupWidth/2
         });
         //only need force for IE6

         $(#backgroundPopup).css({
                 height: windowHeight
         });

 }

 My Problem with this is, that it only centers the Popup correctly if
 you haven't scrolled down the page. What I need is a jQuery way to get
 the height of the actually scolled position to calculate the correct
 value for the top css parameter as well, to get my PopUp every time in
 the correct top/left position without having this scrolling bug.

 Is there a way in jQuery how I can get the scrolled down coordinates?
 I need the height of the scrolled position and by adding the half
 height of the screen resolution I have the css top value which I need
 here.

 Best Regards, May someone can help me?

 Marcel


[jQuery] how to write a frameset with jquery

2009-08-11 Thread cokegen

Hi, I'm trying to output a frameset and I tried everything but can't
get it to work. The frameset never appears in the generated html.

The html and js code is the following:

index.html

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Frameset//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd
html xmlns=http://www.w3.org/1999/xhtml;
head
script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
jquery.min.js type=text/javascript/script
script src=scripts.js type=text/javascript/script
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titlemy page/title
/head
/html

scripts.js

$(function() {

$('html').append('frameset cols=*,31frame src=mainframe.html /
frame src=otherframe.html //frameset');

});

I tried different combinations of prepend(), before(), etc but it's
the same. I suspect that the frameset should be written before the DOM
is loaded, but I don't know if it's that or that I basically don't
understand anything at all :-(

Could someone point me in the right direction ?

Thanks in advance


[jQuery] Image Animation Script not working in IE

2009-08-11 Thread terran

Hi all,

So I created this script and I wasn't actually keeping it in check, so
after I finished it it had stopped working in IE. I tried testing some
functions such as alert('test') after jquery ready, but nothing is
firing anymore. I wanted to know if anyone could see what was wrong
here.

http://terranleung.com/alpha/gs_land

thanks a lot

- Terran


[jQuery] Is there a way to define custom event default handler?

2009-08-11 Thread Taras Bogach

Is there a way to define custom event default handler?
jQuery.fn.bindDefault - this function does not exist, but it would be
nice to have such one to have ability to make equivalent of DOM
default event for custom events.
It have to work just like jQuery.fn.bind, but handlers passed to it
have to be applied after passed to jQuery.fn.bind and if(!
event.isDefaultPrevented()).

Example:

$(#Button)
.bind(custom,function(){alert(handler #1)})
.bindDefault(custom,function(){alert(default handler #1)})
.bindDefault(custom,function(){alert(default handler #2)})
.bind(custom,function(){alert(handler #2)})
.trigger(custom);
//Will alert handler #1, handler #2, default handler #1, default
handler #1.

P.S. Sorry for poor english


[jQuery] Re: Add extra content to the title attribute

2009-08-11 Thread anurag pal
Hi,

Use prepend method.

Regards,
Anurag Pal

On Tue, Aug 11, 2009 at 3:15 PM, Paul Collins pauldcoll...@gmail.comwrote:

 Hi all,
 This is hopefully simple. I have a bunch of links with titles, like
 TITLE=Facebook and so on. I am adding JQuery to make the links open in a
 new window and would like to add some text to the title that says this link
 will open in a new window, whilst keeping the original text. I'm using the
 add JQuery command, but this actually replaces the original title text.

 $(a.newWindow).attr(title,  - This link will open in a new window);

 The end result I would like to have is: title=Facebook - This link will
 open in a new window.

 Could anyone point me in the right direction?!
 Cheers




[jQuery] jquery table editor

2009-08-11 Thread sslhbala

Hi
http://dev.iceburg.net/jquery/tableEditor/demo.php
i worked on jquery table editor . the plugin works well with version
1.0.3 . but it not works with 1.3.2
i found the line of tableEditor.js has having  [ var row = jQuery
(../../td,link);] . the line has a issue. could you forward me to
solve the soln
http://dev.iceburg.net/jquery/tableEditor/jquery.tableEditor.js


[jQuery] [validate] Refreshing the validator after dynamically adding a class to an element

2009-08-11 Thread Jean-Michel

Hi,

I know the refresh() method is gone since version 1.2 but for some
reason even if it's suposed to work without it I can't get it to work.

Here's the scenario:

I got a select box, depending on the selection I want certain element
to validate so I dynamically add validation class to those element
like this.

$(input#element).toggleClass({validate:{required:true}});

But when I click submit the element doesn't get validated at all but I
can see the class has been added in firebug.

Any clues what could be the problem?


[jQuery] i m beginner. how can i start ajax call with jquery

2009-08-11 Thread santosh baral

hi everybody. I m very new to use ajax. but i know the basics of ajax
call and basics of javascript. Please help me how to start with making
ajax call ..please give me also sample code .
Regards
Baral


[jQuery] Ajax Requests Throw Error If User Clicks a Link on a Page While the Request Is Still Active

2009-08-11 Thread zacware

OK, we have our intranet pages setup so that when viewing customer
records, the page is set so that it refreshes various important divs
when the window is brought to the front by the user.

Our system has been working great for years now, but in trying to use
newer browsers we now have big problems.

The problem now with new browsers is that if the users clicks on a
link while a XMLHttpRequest request is currently active, an error is
thrown by the ajax handler

Here's a sample to demo the issue: 
http://homepage.mac.com/zacware/xhr_bug/xhr_bug.htm

We deployed our intranet using FireFox 1 and FireFox 2 years ago.
These never caused the issue, and everything worked great. But now in
trying to use FireFox 3 and Safari 4, we are getting error messages
all over the place.

When this happens, we get a readystate of 4 and a status of 0. I would
like to think there would be an abort error code like when you get a
404 for a file not found.

Does anyone have any thoughts on how I can know definitively that an
error is due to an aborted request versus a more serious error?

I was going to have the error handler ignore errors with a readystate
of 4 and a status of 0, but doing that makes my somewhat
uncomfortable. My original understanding was that a readystate of 4
and a status of 0 was not a defined combination.



[jQuery] Re: Add extra content to the title attribute

2009-08-11 Thread Paul Collins
Thanks for your help guys, that worked a treat.
You're right Liam, that was my bad, there was no add there, I meant
attr, which was the wrong code anyways...

Cheers again
Paul


2009/8/11 anurag pal mail.anurag@gmail.com

 Hi,

 Use prepend method.

 Regards,
 Anurag Pal


 On Tue, Aug 11, 2009 at 3:15 PM, Paul Collins pauldcoll...@gmail.comwrote:

 Hi all,
 This is hopefully simple. I have a bunch of links with titles, like
 TITLE=Facebook and so on. I am adding JQuery to make the links open in a
 new window and would like to add some text to the title that says this link
 will open in a new window, whilst keeping the original text. I'm using the
 add JQuery command, but this actually replaces the original title text.

 $(a.newWindow).attr(title,  - This link will open in a new window);

 The end result I would like to have is: title=Facebook - This link will
 open in a new window.

 Could anyone point me in the right direction?!
 Cheers





[jQuery] Re: Using ScrollTo, IE displays hidden info before it hides it — Any help/ideas?

2009-08-11 Thread jen

Thanks, Stephan!  Yeah, I guess it's time to roll my eyes at IE.  The
client is understanding, so that's cool.  Stupid IE.  At least it
hides by the time the page finishes loading.


[jQuery] Re: [validate] Refreshing the validator after dynamically adding a class to an element

2009-08-11 Thread Jörn Zaefferer

Give that a try: .toggleClass(required)

In your approach, its likely that the metadata isn't picked up, so
you'd have to manually remove the cached metadata, via
.data(metadata, null)

Jörn

On Tue, Aug 11, 2009 at 3:06 AM,
Jean-Micheljean-michel.godin-dug...@voluzion.ca wrote:

 Hi,

 I know the refresh() method is gone since version 1.2 but for some
 reason even if it's suposed to work without it I can't get it to work.

 Here's the scenario:

 I got a select box, depending on the selection I want certain element
 to validate so I dynamically add validation class to those element
 like this.

 $(input#element).toggleClass({validate:{required:true}});

 But when I click submit the element doesn't get validated at all but I
 can see the class has been added in firebug.

 Any clues what could be the problem?



[jQuery] jquery.getjson in safari

2009-08-11 Thread Joru

I have the following code

$(document).ready(function() {
$('#div-res').click(function() {
jQuery.getJSON('http://localhost/tes.php',{},function(jdata){
$('#rdiv-res').html(jdata.data);
   });
  });
});

I work great on firefox and ie7, except in safari(windows or mac)
Is there anyway I can get json correct in $('#rdiv-res').html
(jdata.data) when using safari?


[jQuery] Re: How to bind event handlers to elements

2009-08-11 Thread Leonardo K
U need a id or a classe to find the element.

If u have a id in your input u could do:

$(#id),change(function(){
//your code here
});

If u have a input inside a container that have a class you could do this:

$(.container input).change(function(){
//your code here
});

or with id

$(#container input).change(function(){
 /your code here
});


On Tue, Aug 11, 2009 at 03:28, André Hänsel an...@webkr.de wrote:


 Hi list,

 which is the recommended way to bind event handlers to elements.
 Preferably without giving each of them an id.

 As far as I know, the classic way (input onchange=...) is
 considered deprecated and evil. So what is the jQuery way of doing
 this?

 Regards,
 André



[jQuery] Re: How to bind event handlers to elements

2009-08-11 Thread Richard D. Worth
$('input').bind('change', function() {
  //...
});

or

$('input').change(function() {
  //...
});

See http://docs.jquery.com/Events/bind#typedatafn
and a full list of Event Helpers, such as

http://docs.jquery.com/Events/blur#fn
http://docs.jquery.com/Events/change#fn
http://docs.jquery.com/Events/click#fn
http://docs.jquery.com/Events/dblclick#fn
...

on

http://docs.jquery.com/Events

- Richard

On Tue, Aug 11, 2009 at 2:28 AM, André Hänsel an...@webkr.de wrote:


 Hi list,

 which is the recommended way to bind event handlers to elements.
 Preferably without giving each of them an id.

 As far as I know, the classic way (input onchange=...) is
 considered deprecated and evil. So what is the jQuery way of doing
 this?

 Regards,
 André



[jQuery] Re: Image Animation Script not working in IE

2009-08-11 Thread Charlie





ie hates trailing commas, found one here:

}else{
   $('#back_img').animate({
height:viewportHeight, // remove comma
   },1);

terran wrote:

  Hi all,

So I created this script and I wasn't actually keeping it in check, so
after I finished it it had stopped working in IE. I tried testing some
functions such as alert('test') after jquery ready, but nothing is
firing anymore. I wanted to know if anyone could see what was wrong
here.

http://terranleung.com/alpha/gs_land

thanks a lot

- Terran

  






[jQuery] Refresh DIV with full page refresh

2009-08-11 Thread bharani kumar
Hi All ,

How to refresh DIV , without refresh entire page,

Am having four DIV ,

DIV1,DIV2,DIV3,DIV4


I want to refresh only DIV! without affecting the DIV3,DIV4 ,

Thanks


[jQuery] Re: Problem on IE8

2009-08-11 Thread Gaiz

Point that allow user to change CSS, because page support user's
theme.
Point that I raise this issue because I use jQuery in every browsers
except IE8, it return 0
and other JavaScript framework such as Mootools, it return 0 in every
browsers include IE8.

I think JavaScript Framework should handle browser compatible.
From http://www.w3.org/TR/CSS21/box.html#border-width-properties,
it should return computed value?



On Aug 11, 4:47 pm, Liam Byrne l...@onsight.ie wrote:
 If there's no CSS value explicitly set, then the different browsers will
 default to different default settings.

 There's no point in allowing users to change their CSS if it means that
 your website doesn't work.

 L



 Gaiz wrote:
  User that use my website can customize CSS.
  I do not know why it error onIE8only (IE7, FF is work fine)

  On Aug 11, 2:26 am, Liam Byrne l...@onsight.ie wrote:

  How are you setting the border in CSS ?

  If you set it explicitly, it should work cross-browser

  L

  Gaiz wrote:

  I found 2 problems when I use jQuery onIE8

  1. When I use $('elementId').css('border-top-width'), it return
  medium, but other browsers return 0px
  2. After domready, my page, that's a widget, call ajax to load
  content. On page, it have menu link to call ajax to load value.
  I debug and found no any response from ajax call.

  Anyone have suggestion?
  

  No virus found in this incoming message.
  Checked by AVG -www.avg.com
  Version: 8.5.392 / Virus Database: 270.13.49/2294 - Release Date: 
  08/10/09 06:10:00
  

  No virus found in this incoming message.
  Checked by AVG -www.avg.com
  Version: 8.5.392 / Virus Database: 270.13.50/2296 - Release Date: 
  08/11/09 06:10:00


[jQuery] Re: Refresh DIV with full page refresh

2009-08-11 Thread Dhruva Sagar
What exactly do you mean by 'refresh DIV' ?If you want to get some content
in the page and update the DIV without loading/refreshing the entire page,
then you should use ajax calls to your server.

If you can explain what you want in a bit more detail perhaps I could help
you a bit more.

Thanks  Regards,
Dhruva Sagar.


Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html  -
The trouble with a kitten is that when it grows up, it's always a cat.

On Tue, Aug 11, 2009 at 6:28 PM, bharani kumar 
bharanikumariyer...@gmail.com wrote:

 Hi All ,

 How to refresh DIV , without refresh entire page,

 Am having four DIV ,

 DIV1,DIV2,DIV3,DIV4


 I want to refresh only DIV! without affecting the DIV3,DIV4 ,

 Thanks



[jQuery] Re: i m beginner. how can i start ajax call with jquery

2009-08-11 Thread Charlie






lots of examples

http://docs.jquery.com/Ajax

santosh baral wrote:

  hi everybody. I m very new to use ajax. but i know the basics of ajax
call and basics of _javascript_. Please help me how to start with making
ajax call ..please give me also sample code .
Regards
Baral

  






[jQuery] Re: Refresh DIV with full page refresh

2009-08-11 Thread bharani kumar
We can refresh one DIV jquery script, wiht out entire page refresh ...

On Tue, Aug 11, 2009 at 6:30 PM, Dhruva Sagar dhruva.sa...@gmail.comwrote:

 What exactly do you mean by 'refresh DIV' ?If you want to get some content
 in the page and update the DIV without loading/refreshing the entire page,
 then you should use ajax calls to your server.

 If you can explain what you want in a bit more detail perhaps I could help
 you a bit more.

 Thanks  Regards,
 Dhruva Sagar.


 Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - 
 The trouble with a kitten is that when it grows up, it's always a cat.

 On Tue, Aug 11, 2009 at 6:28 PM, bharani kumar 
 bharanikumariyer...@gmail.com wrote:

 Hi All ,

 How to refresh DIV , without refresh entire page,

 Am having four DIV ,

 DIV1,DIV2,DIV3,DIV4


 I want to refresh only DIV! without affecting the DIV3,DIV4 ,

 Thanks





-- 
Regards
B.S.Bharanikumar
http://php-mysql-jquery.blogspot.com/


[jQuery] Re: Image Animation Script not working in IE

2009-08-11 Thread terran

Thank you very much, that worked perfectly =D

On Aug 11, 8:56 am, Charlie charlie...@gmail.com wrote:
 ie hates trailing commas, found one here:
 }else{
             $('#back_img').animate({               
                 height:viewportHeight, // remove comma
             },1);
 terran wrote:Hi all, So I created this script and I wasn't actually keeping 
 it in check, so after I finished it it had stopped working in IE. I tried 
 testing some functions such as alert('test') after jquery ready, but nothing 
 is firing anymore. I wanted to know if anyone could see what was wrong 
 here.http://terranleung.com/alpha/gs_landthanks a lot - Terran


[jQuery] Replace script tag

2009-08-11 Thread Lay András

Hello!

I used this little code to replace some content with jquery:

script type=text/javascript
function Csere() {
$('#lufi').replaceWith('Duma');
}
/script

p11script type=text/javascript id=lufiCsere()/script22/p

This works fine, but i'd like to eliminate the id attribute from
script tag. I tried $(this).replaceWith('Duma'), and
$(this).parent().replaceWith('Duma'), but neither works. How can I
solve this?

Lay


[jQuery] How to identify if user chose to see secure only or secure and nonsecure items

2009-08-11 Thread son

Hi. I don't know if this is the right place for this question.
If not, pls let me know where this should be go to.

My site is secure but also contain non secure items from google
adsense. users have the options to view secure only or secure and non-
secure item.

I would like to be able to identify what that user chose so I can show
some other things if they choose to only see secure items.

Any help will be appreciated.

Son


[jQuery] Re: Refresh DIV with full page refresh

2009-08-11 Thread Charlie





$("div").refresh()

that function should give you as much success as trying to understand
the *details* of your request.

bharani kumar wrote:
We can refresh one DIV jquery script, wiht out entire page
refresh ...
  
  On Tue, Aug 11, 2009 at 6:30 PM, Dhruva
Sagar dhruva.sa...@gmail.com
wrote:
  What
exactly do you mean by 'refresh DIV' ?
If you want to get some content in the page and update the DIV
without loading/refreshing the entire page, then you should use ajax
calls to your server.


If you can explain what you want in a bit more detail perhaps
I could help you a bit more.


Thanks  Regards,
Dhruva Sagar.


Ogden Nash - "The trouble with a kitten is that
when it grows up, it's always a cat."



On Tue, Aug 11, 2009 at 6:28 PM, bharani
kumar bharanikumariyer...@gmail.com
wrote:

Hi All ,
  
How to refresh DIV , without refresh entire page,
  
Am having four DIV ,
  
DIV1,DIV2,DIV3,DIV4
  
  
I want to refresh only DIV! without affecting the DIV3,DIV4 ,
  
Thanks 






  
  
  
  
  
-- 
Regards
B.S.Bharanikumar
  http://php-mysql-jquery.blogspot.com/






[jQuery] Re: Refresh DIV with full page refresh

2009-08-11 Thread Liam Potter


Be nice :p, obviously his first language is not English.

you should be using jQuery's ajax functions.
http://docs.jquery.com/Ajax

Charlie wrote:

$(div).refresh()

that function should give you as much success as trying to understand 
the *details* of your request.


bharani kumar wrote:

We can refresh one DIV jquery script, wiht out entire page refresh ...

On Tue, Aug 11, 2009 at 6:30 PM, Dhruva Sagar dhruva.sa...@gmail.com 
mailto:dhruva.sa...@gmail.com wrote:


What exactly do you mean by 'refresh DIV' ?
If you want to get some content in the page and update the DIV
without loading/refreshing the entire page, then you should use
ajax calls to your server.

If you can explain what you want in a bit more detail perhaps I
could help you a bit more.

Thanks  Regards,
Dhruva Sagar.


Ogden Nash
http://www.brainyquote.com/quotes/authors/o/ogden_nash.html  -
The trouble with a kitten is that when it grows up, it's always
a cat.

On Tue, Aug 11, 2009 at 6:28 PM, bharani kumar
bharanikumariyer...@gmail.com
mailto:bharanikumariyer...@gmail.com wrote:

Hi All ,

How to refresh DIV , without refresh entire page,

Am having four DIV ,

DIV1,DIV2,DIV3,DIV4


I want to refresh only DIV! without affecting the DIV3,DIV4 ,

Thanks





--
Regards
B.S.Bharanikumar
http://php-mysql-jquery.blogspot.com/






[jQuery] How to specify a default value...

2009-08-11 Thread Rick Faircloth
I was shown how to use this inline condition for creating yes/no Boolean
values instead of

the normal true/false values javascript uses:

 

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 

I'd like to know if there's an equivalent inline method for providing a
default value

when no value is present, such as:

 

span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') +
'/span

 

Basically, if there's no value in the current row as position 20, then just
us 'N/A'.

 

Is this possible with a simple inline condition, too?

 

Thanks,

 

Rick

 


--

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

 



[jQuery] Re: listmenu

2009-08-11 Thread Paul Speranza

Jack, yes, the list menu plugin.




On Aug 10, 3:01 pm, Jack Killpatrick j...@ihwy.com wrote:
 Hi Paul,

 Thanks for this info, I'll add it to my test cases and thanks for
 letting the community know.

 I was actually working on a new version of the plugin yesterday, which
 adds one new feature: an onClick option that you can pass a function to
 for handling clicks in the dropdown menu. If that's a feature that might
 be of interest to you I can get you a copy of the pre-release version.

 I'll look into what you reported.

 Oh, uh, just to make sure, you're talking about thelistmenuplugin, right?

 http://www.ihwy.com/Labs/jquery-listmenu-plugin.aspx

 Thanks,
 Jack



 Paul Speranza wrote:
  This may not be a bug in the jQuery List menu widget but if it saves
  someone the time it took me to figure it out or the author has an idea
  of how to handle this then it is worth it. If the items begin with a
  comma - , Paul - it causes the columns in the result to not be
  created in IE 7 and the results just show straight down. In Chrome,
  Firefox 3.5 and the latest Safari the results do not show at all.

  I spent a couple of hours tracking this down and I just cleaned up the
  data that I was playing with. Maybe the widget can strip off leading
  characters that are not letters or numbers.

  Great widget though!

  Paul Speranza- Hide quoted text -

 - Show quoted text -


[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth
Well.to answer my own question.I found this works:

 

out.push('lispan class=spanLeftPet Deposit/spanspan
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + '/span/li');

 

But how does the conditional know whether a Boolean is being checked, as in:

 

' + (row[19] ? 'Yes' : 'No') + '

 

Or whether the presence of a value is being checked, as in:

 

' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 

What's the logic that's occurring behind the statements to differentiate?

 

Thanks for any insight.

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 10:39 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How to specify a default value...

 

I was shown how to use this inline condition for creating yes/no Boolean
values instead of

the normal true/false values javascript uses:

 

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 

I'd like to know if there's an equivalent inline method for providing a
default value

when no value is present, such as:

 

span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') +
'/span

 

Basically, if there's no value in the current row as position 20, then just
us 'N/A'.

 

Is this possible with a simple inline condition, too?

 

Thanks,

 

Rick

 


--

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

 



[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth
Well..another unexpected result.

 

When the inline conditional:

 

' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 

is used when a *value is present* in row[19], I get this as the output:

 

+ row[19] +

 

instead of the actual value. 

 

If I remove the quotes from ' + row[19] + ', I get a syntax error.

 

However, if *no value is present* in row[19], I get

 

N/A

 

as the output, which is expected.

 

So, the conditional is working if no value is present, but outputting the
literal string

 

+ row[19] +

 

if a value is not present.

 

Assistance in understanding, anyone?

 

Thanks,

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 11:00 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...

 

Well.to answer my own question.I found this works:

 

out.push('lispan class=spanLeftPet Deposit/spanspan
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + '/span/li');

 

But how does the conditional know whether a Boolean is being checked, as in:

 

' + (row[19] ? 'Yes' : 'No') + '

 

Or whether the presence of a value is being checked, as in:

 

' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 

What's the logic that's occurring behind the statements to differentiate?

 

Thanks for any insight.

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 10:39 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How to specify a default value...

 

I was shown how to use this inline condition for creating yes/no Boolean
values instead of

the normal true/false values javascript uses:

 

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 

I'd like to know if there's an equivalent inline method for providing a
default value

when no value is present, such as:

 

span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') +
'/span

 

Basically, if there's no value in the current row as position 20, then just
us 'N/A'.

 

Is this possible with a simple inline condition, too?

 

Thanks,

 

Rick

 


--

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

 



[jQuery] Re: How to specify a default value...

2009-08-11 Thread Liam Potter


Your concatenation is broke, (I'm assuming the logic behind this is 
actually working)


this
' + (row[19] ? '+ row[19] + ' : 'N/A') + '

should be

' + (row[19] ? ''+ row[19] + '' : 'N/A') + '


As for what is going on here, it's just an if statement shortened down, 
and could be written like this


if ( row[19] ) {
row[19]
} else {
N/A
}

Rick Faircloth wrote:


Well..another unexpected result…

When the inline conditional:

’ + (row[19] ? ‘ + row[19] + ‘ : ‘N/A’) + ‘

is used when a **value is present** in row[19], I get this as the output:

+ row[19] +

instead of the actual value.

If I remove the quotes from ‘ + row[19] + ‘, I get a syntax error.

However, if **no value is present** in row[19], I get

N/A

as the output, which is expected.

So, the conditional is working if no value is present, but outputting 
the literal string


+ row[19] +

if a value is not present.

Assistance in understanding, anyone?

Thanks,

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 11:00 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: How to specify a default value...

Well…to answer my own question…I found this works:

out.push('lispan class=spanLeftPet Deposit/spanspan 
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + 
'/span/li');


But how does the conditional know whether a Boolean is being checked, 
as in:


’ + (row[19] ? ‘Yes’ : ‘No’) + ‘

Or whether the presence of a value is being checked, as in:

’ + (row[19] ? ‘ + row[19] + ‘ : ‘N/A’) + ‘

What’s the logic that’s occurring behind the statements to differentiate?

Thanks for any insight…

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 10:39 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] How to specify a default value...

I was shown how to use this inline condition for creating yes/no 
Boolean values instead of


the normal true/false values javascript uses:

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

I’d like to know if there’s an equivalent inline method for providing 
a default value


when no value is present, such as:

span class=”spanRight”’ + (row[20] ? ‘NORMAL ROW[20] VALUE’ : ‘N/A’) 
+ ‘/span


Basically, if there’s no value in the current row as position 20, then 
just us ‘N/A’.


Is this possible with a simple inline condition, too?

Thanks,

Rick

--

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






[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth
And finally, to continue today's live, public coding experiments.

 

The answer appears to be that a second set of ' ' are needed for the
conditional:

 

' (row[19] ?  ' ' + row[19] + ' ' : 'N/A') + '

 

Instead of:

 

'(row[19] ? ' + row[19] + ' : 'N/A') + '

 

The first way works with both Boolean and null checks, whereas the second

way works properly only with Boolean.

 

Sorry to use up to much list-time to answer my own questions, but hopefully

this will help someone as an impromptu tutorial.

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 11:18 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...

 

Well..another unexpected result.

 

When the inline conditional:

 

' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 

is used when a *value is present* in row[19], I get this as the output:

 

+ row[19] +

 

instead of the actual value. 

 

If I remove the quotes from ' + row[19] + ', I get a syntax error.

 

However, if *no value is present* in row[19], I get

 

N/A

 

as the output, which is expected.

 

So, the conditional is working if no value is present, but outputting the
literal string

 

+ row[19] +

 

if a value is not present.

 

Assistance in understanding, anyone?

 

Thanks,

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 11:00 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...

 

Well.to answer my own question.I found this works:

 

out.push('lispan class=spanLeftPet Deposit/spanspan
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + '/span/li');

 

But how does the conditional know whether a Boolean is being checked, as in:

 

' + (row[19] ? 'Yes' : 'No') + '

 

Or whether the presence of a value is being checked, as in:

 

' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 

What's the logic that's occurring behind the statements to differentiate?

 

Thanks for any insight.

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 11, 2009 10:39 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How to specify a default value...

 

I was shown how to use this inline condition for creating yes/no Boolean
values instead of

the normal true/false values javascript uses:

 

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 

I'd like to know if there's an equivalent inline method for providing a
default value

when no value is present, such as:

 

span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') +
'/span

 

Basically, if there's no value in the current row as position 20, then just
us 'N/A'.

 

Is this possible with a simple inline condition, too?

 

Thanks,

 

Rick

 


--

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

 



[jQuery] attr doesn't work in IE6 and Chromium

2009-08-11 Thread Julijan Andjelic

script type=text/javascript
$(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text('');
sch('brands', '?echo $data[0][brand].');?).text( / ?echo $data
[0][brand];?);
$(#sitemap a:eq(2)).attr(onclick, $('#sitemap a:eq(1)').text('');
sch('categories', '?echo $data[0][category].');?).text( / ?
echo $data[0][category];?);
/script

This works perfectly in Firefox and Opera, but Chromium and IE6 only
change the text to value of $data[0][brand/category] (which is a
string) and seem to ignore the onclick attr, any ideas?


[jQuery] Re: How to specify a default value...

2009-08-11 Thread Liam Potter


oi, don't be skipping over my answers :p lol

Rick Faircloth wrote:


And finally, to continue today’s live, public coding experiments…

The answer appears to be that a second set of ‘ ‘ are needed for the 
conditional:


’ (row[19] ? ‘ ‘ + row[19] + ‘ ‘ : ‘N/A’) + ‘

Instead of:

’(row[19] ? ‘ + row[19] + ‘ : ‘N/A’) + ‘

The first way works with both Boolean and null checks, whereas the second

way works properly only with Boolean.

Sorry to use up to much list-time to answer my own questions, but 
hopefully


this will help someone as an “impromptu tutorial”…

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 11:18 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: How to specify a default value...

Well..another unexpected result…

When the inline conditional:

’ + (row[19] ? ‘ + row[19] + ‘ : ‘N/A’) + ‘

is used when a **value is present** in row[19], I get this as the output:

+ row[19] +

instead of the actual value.

If I remove the quotes from ‘ + row[19] + ‘, I get a syntax error.

However, if **no value is present** in row[19], I get

N/A

as the output, which is expected.

So, the conditional is working if no value is present, but outputting 
the literal string


+ row[19] +

if a value is not present.

Assistance in understanding, anyone?

Thanks,

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 11:00 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: How to specify a default value...

Well…to answer my own question…I found this works:

out.push('lispan class=spanLeftPet Deposit/spanspan 
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + 
'/span/li');


But how does the conditional know whether a Boolean is being checked, 
as in:


’ + (row[19] ? ‘Yes’ : ‘No’) + ‘

Or whether the presence of a value is being checked, as in:

’ + (row[19] ? ‘ + row[19] + ‘ : ‘N/A’) + ‘

What’s the logic that’s occurring behind the statements to differentiate?

Thanks for any insight…

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 10:39 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] How to specify a default value...

I was shown how to use this inline condition for creating yes/no 
Boolean values instead of


the normal true/false values javascript uses:

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

I’d like to know if there’s an equivalent inline method for providing 
a default value


when no value is present, such as:

span class=”spanRight”’ + (row[20] ? ‘NORMAL ROW[20] VALUE’ : ‘N/A’) 
+ ‘/span


Basically, if there’s no value in the current row as position 20, then 
just us ‘N/A’.


Is this possible with a simple inline condition, too?

Thanks,

Rick

--

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






[jQuery] Re: attr doesn't work in IE6 and Chromium

2009-08-11 Thread Liam Potter


wow... I'm not even sure what your are trying to achieve with thisno 
need for doing this through the onclick attribute, and I can't think why 
you are trying to set the onclick with some javascript?


Julijan Andjelic wrote:

script type=text/javascript
$(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text('');
sch('brands', '?echo $data[0][brand].');?).text( / ?echo $data
[0][brand];?);
$(#sitemap a:eq(2)).attr(onclick, $('#sitemap a:eq(1)').text('');
sch('categories', '?echo $data[0][category].');?).text( / ?
echo $data[0][category];?);
/script

This works perfectly in Firefox and Opera, but Chromium and IE6 only
change the text to value of $data[0][brand/category] (which is a
string) and seem to ignore the onclick attr, any ideas?
  




[jQuery] Code: a generic jQuery+plugin loader/packer

2009-08-11 Thread Stephan Beal

Hi, all!

i threw the following together, have gotten good use out of it, and
thought someone else out there might find it useful. It's used like
this:

script src='include/jquery.js.php?
version=1.3.2plugins=cookie,html,tipbox-mod' type='text/javascript'/
script

As one can surmise, this script emits the JS code for jQuery and all
requested plugins. If passed no 'version' parameter then it only
returns the plugins (which can be used to load them individually,
after jQuery has already been loaded).

From the above example, include is the directory containing the
following files:

- jquery.js.php (see code, below)
- jquery-1.3.2.js (1.3.2== the 'version' param passed above)
- jquery.cookie.js
- jquery.html.js
- jquery.topbox-mod.js

It will prefer files named *.min.js or *.pack.js over *.js, but
it also gzips the output using ob_gzhandler, so minimizing/packing
brings little benefit (unless you also remove the ob_xxx() lines).

The implementation (only tested with PHP5 - might work in PHP4):

?php
/**
 jQuery_pack_sources() emits JS source code for jQuery and, optionaly,
 jquery plugins which follow the naming convention of
jquery.PLUGIN.js.
 It looks for $_REQUEST['plugins'] or $_ENV['plugins'],
 expecting a space/comma-delimited list of jquery plugins emit.
 (Reminder: $_ENV is checked so that i can use the from the command-
line.)

 The $jqueryVersion param specifies the version of the core to use,
and
 should be in the the form X.Y.Z, such that jquery-X.Y.Z.js is the
file
 where jquery lives. If it is null then only plugins are emitted.

Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)
License: Public Domain.
*/
function jQuery_pack_sources($jqueryVersion=null)
{
if( ! $jqueryVersion ) $jqueryVersion = @$_REQUEST['version'];
$key = 'plugins';
$mod = @$_REQUEST[$key];
if( ! $mod ) $mod = @$_ENV[$key];
if($mod) $mod = preg_split('/(\s|,)/',$mod, -1,
PREG_SPLIT_NO_EMPTY);
if(!$mod) $mod = array();
if( $jqueryVersion )
{
array_unshift($mod,$jqueryVersion);
}
$mod = array_map('trim',$mod);
$ext = array(
'.min.js',
'.pack.js',
'.js'
);
$flist = array();
foreach( $mod as $m )
{
$sep = preg_match('/^\d/',$m) ? '-' : '.'; // kludge for
jquery-X.Y.Z.js
$got = false;
foreach( $ext as $ex )
{
$fn = 'jquery'.$sep.$m.$ex;
if( !...@file_exists($fn) ) continue;
$got = true;
$flist[] = $fn;
break;
}
if( ! $got )
{
throw new Exception(Could not find module [$m] in file
[$fn]!);
}
echo \n;
}
echo /** Start of amalgamation of: .implode(', ',$flist). */
\n;
foreach( $flist as $fn )
{

echo /** Begin file [$fn] **/\n;
echo file_get_contents($fn);
echo /** End file [$fn] **/\n;
}
echo /** End of amalgamation of: .implode(',',$flist). */\n;
}
ob_start('ob_gzhandler');
jQuery_pack_sources();
header('Content-Type: text/javascript');
header('Transfer-Length: '.ob_get_length());
ob_end_flush();
exit(0);
?


Happy hacking!


[jQuery] Re: attr doesn't work in IE6 and Chromium

2009-08-11 Thread Stephan Beal

On Aug 11, 5:35 pm, Julijan Andjelic julijan.andje...@gmail.com
wrote:
 script type=text/javascript
 $(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text('');

have you tried:

$(#sitemap a:eq(1)).click();

?

that is the canonical way to add an onclick handler in jquery.


[jQuery] Re: [validate] Refreshing the validator after dynamically adding a class to an element

2009-08-11 Thread Jean-Michel

Thanks, doing .toggleClass(required) fixed everything.

On Aug 11, 9:32 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Give that a try: .toggleClass(required)

 In your approach, its likely that the metadata isn't picked up, so
 you'd have to manually remove the cached metadata, via
 .data(metadata, null)

 Jörn

 On Tue, Aug 11, 2009 at 3:06 AM,

 Jean-Micheljean-michel.godin-dug...@voluzion.ca wrote:

  Hi,

  I know the refresh() method is gone since version 1.2 but for some
  reason even if it's suposed to work without it I can't get it to work.

  Here's the scenario:

  I got a select box, depending on the selection I want certain element
  to validate so I dynamically add validation class to those element
  like this.

  $(input#element).toggleClass({validate:{required:true}});

  But when I click submit the element doesn't get validated at all but I
  can see the class has been added in firebug.

  Any clues what could be the problem?


[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth

Sorry! :o)

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Liam Potter
Sent: Tuesday, August 11, 2009 11:45 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...


oi, don't be skipping over my answers :p lol

Rick Faircloth wrote:

 And finally, to continue today's live, public coding experiments.

 The answer appears to be that a second set of ' ' are needed for the 
 conditional:

 ' (row[19] ? ' ' + row[19] + ' ' : 'N/A') + '

 Instead of:

 '(row[19] ? ' + row[19] + ' : 'N/A') + '

 The first way works with both Boolean and null checks, whereas the second

 way works properly only with Boolean.

 Sorry to use up to much list-time to answer my own questions, but 
 hopefully

 this will help someone as an impromptu tutorial.

 Rick

 *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 *On Behalf Of *Rick Faircloth
 *Sent:* Tuesday, August 11, 2009 11:18 AM
 *To:* jquery-en@googlegroups.com
 *Subject:* [jQuery] Re: How to specify a default value...

 Well..another unexpected result.

 When the inline conditional:

 ' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 is used when a **value is present** in row[19], I get this as the output:

 + row[19] +

 instead of the actual value.

 If I remove the quotes from ' + row[19] + ', I get a syntax error.

 However, if **no value is present** in row[19], I get

 N/A

 as the output, which is expected.

 So, the conditional is working if no value is present, but outputting 
 the literal string

 + row[19] +

 if a value is not present.

 Assistance in understanding, anyone?

 Thanks,

 Rick

 *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 *On Behalf Of *Rick Faircloth
 *Sent:* Tuesday, August 11, 2009 11:00 AM
 *To:* jquery-en@googlegroups.com
 *Subject:* [jQuery] Re: How to specify a default value...

 Well.to answer my own question.I found this works:

 out.push('lispan class=spanLeftPet Deposit/spanspan 
 class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + 
 '/span/li');

 But how does the conditional know whether a Boolean is being checked, 
 as in:

 ' + (row[19] ? 'Yes' : 'No') + '

 Or whether the presence of a value is being checked, as in:

 ' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 What's the logic that's occurring behind the statements to differentiate?

 Thanks for any insight.

 Rick

 *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 *On Behalf Of *Rick Faircloth
 *Sent:* Tuesday, August 11, 2009 10:39 AM
 *To:* jquery-en@googlegroups.com
 *Subject:* [jQuery] How to specify a default value...

 I was shown how to use this inline condition for creating yes/no 
 Boolean values instead of

 the normal true/false values javascript uses:

 span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 I'd like to know if there's an equivalent inline method for providing 
 a default value

 when no value is present, such as:

 span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') 
 + '/span

 Basically, if there's no value in the current row as position 20, then 
 just us 'N/A'.

 Is this possible with a simple inline condition, too?

 Thanks,

 Rick



--

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





[jQuery] jQuery not working with content that is loaded in.

2009-08-11 Thread cz231

Hi,

I'm building an online application, and I want one widget to refresh
every time a user clicks a certain element. So I wrote a jQuery on
click listener that initializes the function to reload the widget.
However, when the widget is reloaded, all of the javascript effects
stop working for that widget only. It's like I disabled javascript for
that part of the page only. Javascript still works everywhere else.


Can any of you jQuery gurus think of a reason why? (preferably one
with an easy fix :P)


[jQuery] Re: $ajax() question

2009-08-11 Thread Stephan Beal

On Aug 11, 11:53 am, Jules jwira...@gmail.com wrote:
 After re-reading the original post, it seems json is not required

 just use
 data:Args=+args2

Don't do that. If args2 contains any invalid characters (i.e. a space)
then this will fail, possibly in mysterious ways. Always send the data
as an object of key/value pairs, and let the jquery internals escape
it for you.


[jQuery] Re: AJAX and JSON

2009-08-11 Thread Stephan Beal

On Aug 11, 5:13 am, MorningZ morni...@gmail.com wrote:
 I'd also recommend against use of $.getJSON for a totally different
 reason:

 There is no option to catch errors.

You can: you have to set a global ajax error handler to catch it,
though. Not pretty, but it's suitable for many simple cases (where all
errors should go through the same reporter).


[jQuery] Re: AJAX and JSON

2009-08-11 Thread Stephan Beal

On Aug 11, 6:14 am, Cam Spiers camspi...@gmail.com wrote:
 I also recommend using json2.js for anything more then just a basic
 key-value json string.


Another nice feature of json2.js is that you can use it to deeply
clone objects:

var orig = {};
var clone = JSON.parse(JSON.stringify(orig));

i've found that really useful in avoiding cross-object references in
my JSON trees.


[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth

Thanks, Liam...

You'll see in my answers to my own posts that I finally figured out
the extra set of quotes was needed.

What I still don't understand is even how this logic works:

if ( row[19] ) {
row[19]
} else {
N/A
}

As a non-null check, it seems the statement would need to be asking:

if there is a value at row[19], use that value...otherwise us 'N/A'

As a Boolean check, the statement would be:

if   ( row[19] == 'true' )
 { 'Yes' }
else { 'No'  }

(Assuming I wrote that correctly...)

It seems the statement would be asking:

if the value at row[19] is 'true', use 'Yes' as the output value,
otherwise, use 'No'

In other words, how does the conditional know what's being asked in the
shorthand version?

' + (row[19] ? '' + row[19] + '' : 'N/A') + '

That first part:

' + row[19] ? '

works the same for both value checks and Boolean checks.

How?

Rick


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Liam Potter
Sent: Tuesday, August 11, 2009 11:24 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...


Your concatenation is broke, (I'm assuming the logic behind this is 
actually working)

this
 ' + (row[19] ? '+ row[19] + ' : 'N/A') + '

should be
' + (row[19] ? ''+ row[19] + '' : 'N/A') + '

As for what is going on here, it's just an if statement shortened down, 
and could be written like this

if ( row[19] ) {
row[19]
} else {
N/A
}

Rick Faircloth wrote:

 Well..another unexpected result.

 When the inline conditional:

 ' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 is used when a **value is present** in row[19], I get this as the output:

 + row[19] +

 instead of the actual value.

 If I remove the quotes from ' + row[19] + ', I get a syntax error.

 However, if **no value is present** in row[19], I get

 N/A

 as the output, which is expected.

 So, the conditional is working if no value is present, but outputting 
 the literal string

 + row[19] +

 if a value is not present.

 Assistance in understanding, anyone?

 Thanks,

 Rick

 *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 *On Behalf Of *Rick Faircloth
 *Sent:* Tuesday, August 11, 2009 11:00 AM
 *To:* jquery-en@googlegroups.com
 *Subject:* [jQuery] Re: How to specify a default value...

 Well.to answer my own question.I found this works:

 out.push('lispan class=spanLeftPet Deposit/spanspan 
 class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + 
 '/span/li');

 But how does the conditional know whether a Boolean is being checked, 
 as in:

 ' + (row[19] ? 'Yes' : 'No') + '

 Or whether the presence of a value is being checked, as in:

 ' + (row[19] ? ' + row[19] + ' : 'N/A') + '

 What's the logic that's occurring behind the statements to differentiate?

 Thanks for any insight.

 Rick

 *From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 *On Behalf Of *Rick Faircloth
 *Sent:* Tuesday, August 11, 2009 10:39 AM
 *To:* jquery-en@googlegroups.com
 *Subject:* [jQuery] How to specify a default value...

 I was shown how to use this inline condition for creating yes/no 
 Boolean values instead of

 the normal true/false values javascript uses:

 span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

 I'd like to know if there's an equivalent inline method for providing 
 a default value

 when no value is present, such as:

 span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') 
 + '/span

 Basically, if there's no value in the current row as position 20, then 
 just us 'N/A'.

 Is this possible with a simple inline condition, too?

 Thanks,

 Rick



--

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





[jQuery] Validation Error message help

2009-08-11 Thread Dave Maharaj :: WidePixels.com
I have this script:
 
$(document).ready( function() {
 
$('#username').blur( function () {
 
fieldName = $(this).attr('id');
fieldValue = $(this).val();
 
$.post('/users/ajax_validate', {
field: fieldName,
value: fieldValue
},
   function(error) {
 
   if(error.length != 0) {
 
   $('#username').after('div class=error-message
id='+ fieldName +'-exists' + error + '/div');
   }
   else {
   $('#' + fieldName + '-exists').remove();
   }
   });
 });   
 
});
 
So when the user leaves the field it checks validation. If error it shows an
error message. Everything is working fine except if the user goes back to
the field where there was an error and does not chnge anything and leaves
the field again the error message is duplicated.
 
So they enter a username peter it says Please choose a different name if
they go back to the username and thenleavewith out changing peter i now
have:
 Please choose a different name
Please choose a different name
 
What do I have to change / add so that only 1 message will appear?
 
Thanks
 
Dave 


[jQuery] fadeIn() failing the second time it's called.

2009-08-11 Thread Perceptes

Hi all,

I'm working on an interface with two different chains of animations.
The page shows 5 pets and allows the user to click on one of them for
details. When one is clicked, the other pets disappear, the selected
one's image slides to the left and the content appears. When the image
is clicked again, the reverse happens, the content disappears, the
image slides back into its original position, and the other pets
appear again.

I decided to implement the code for this as a plugin, which I'm
calling Pick An Item, as an exercise in both writing a plugin and
abstracting code. Everything is working as expected except for one
issue I haven't been able to figure out. After you've gone through a
full cycle of selecting/deselecting a pet, the next time you select
that same pet, when it gets to the point where the content should
appear, it doesn't. Further clicks on the selected pet do not reverse
the effect like they should. Each individual pet works correctly for
one open/close cycle but then fails for subsequent opens. I've gone
over and over it and I don't see what's different between the initial
state of the page/script and the state after an open/close cycle has
finished.

This is my first attempt at writing a plugin so no doubt a lot of it
can be done better/more simply, but I'm hoping someone can make sense
of what I've written and see where I'm getting tripped up.

I've put the page online so you can see it in action: 
http://www.minibontown.com/dev/
and for your convenience, here is the plugin code in a pastebin:
http://pastie.org/580152

Line 73 is where it fails. That call seems to have no effect the
second time through.

Thanks in advance for any help anyone can provide!


[jQuery] Re: How to specify a default value...

2009-08-11 Thread Liam Potter


Hi Rick,

I think these explanations are correct, if not someone else should 
correct me :p


so, row[19] is kind of like an object and it contains the value of 
whatever row[19] is.

so lets say row[19] is this divHello/div

In your 'Boolean' example, this is what is happening
If row[19] exists in the dom, print 'Yes', if not print 'No'

Now in the 'non-null' example, essentially the exact same check is 
happening, but you have replaced Yes with the row[19] object, which 
contains the value of Hello, so we get this


If row[19] exists in the dom, print row[19]'s value, if not print 'N/A'

So, you can see, the second example is not checking if row[19] has a 
value, but whether or not it exists at all.


Now, I would take this with a pinch of salt, as my programming theory is 
poor at best, but this is what I think is happening.


- Liam

Rick Faircloth wrote:

Thanks, Liam...

You'll see in my answers to my own posts that I finally figured out
the extra set of quotes was needed.

What I still don't understand is even how this logic works:

if ( row[19] ) {
row[19]
} else {
N/A
}

As a non-null check, it seems the statement would need to be asking:

if there is a value at row[19], use that value...otherwise us 'N/A'

As a Boolean check, the statement would be:

if   ( row[19] == 'true' )
 { 'Yes' }
else { 'No'  }

(Assuming I wrote that correctly...)

It seems the statement would be asking:

if the value at row[19] is 'true', use 'Yes' as the output value,
otherwise, use 'No'

In other words, how does the conditional know what's being asked in the
shorthand version?

  

' + (row[19] ? '' + row[19] + '' : 'N/A') + '



That first part:

  

' + row[19] ? '



works the same for both value checks and Boolean checks.

How?

Rick


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Liam Potter
Sent: Tuesday, August 11, 2009 11:24 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...


Your concatenation is broke, (I'm assuming the logic behind this is 
actually working)


this
 ' + (row[19] ? '+ row[19] + ' : 'N/A') + '

should be
  

' + (row[19] ? ''+ row[19] + '' : 'N/A') + '



As for what is going on here, it's just an if statement shortened down, 
and could be written like this


if ( row[19] ) {
row[19]
} else {
N/A
}

Rick Faircloth wrote:
  

Well..another unexpected result.

When the inline conditional:



' + (row[19] ? ' + row[19] + ' : 'N/A') + '
  

is used when a **value is present** in row[19], I get this as the output:

+ row[19] +

instead of the actual value.

If I remove the quotes from ' + row[19] + ', I get a syntax error.

However, if **no value is present** in row[19], I get

N/A

as the output, which is expected.

So, the conditional is working if no value is present, but outputting 
the literal string


+ row[19] +

if a value is not present.

Assistance in understanding, anyone?

Thanks,

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 11:00 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: How to specify a default value...

Well.to answer my own question.I found this works:

out.push('lispan class=spanLeftPet Deposit/spanspan 
class=spanRight' + (row[19] ? ' + row[19] + ' : 'N/A') + 
'/span/li');


But how does the conditional know whether a Boolean is being checked, 
as in:




' + (row[19] ? 'Yes' : 'No') + '
  

Or whether the presence of a value is being checked, as in:



' + (row[19] ? ' + row[19] + ' : 'N/A') + '
  

What's the logic that's occurring behind the statements to differentiate?

Thanks for any insight.

Rick

*From:* jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
*On Behalf Of *Rick Faircloth

*Sent:* Tuesday, August 11, 2009 10:39 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] How to specify a default value...

I was shown how to use this inline condition for creating yes/no 
Boolean values instead of


the normal true/false values javascript uses:

span class=spanRight' + (row[20] ? 'Yes' : 'No') + '/span

I'd like to know if there's an equivalent inline method for providing 
a default value


when no value is present, such as:

span class=spanRight' + (row[20] ? 'NORMAL ROW[20] VALUE' : 'N/A') 
+ '/span


Basically, if there's no value in the current row as position 20, then 
just us 'N/A'.


Is this possible with a simple inline condition, too?

Thanks,

Rick





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






  




[jQuery] Re: AJAX calls acting syncronously

2009-08-11 Thread sak

Hi Nick

Thanks so much that sorted it all out.it's been bugging me for the
last two days, but had to put it aside to continue with other work.
Just ran a test now and it works as expected.

I get the jist of what was going on now but I'll need to research it a
little more indepth to fully understand what was happening on the
server side.

Thanks again much appreciated.

Sak

On Aug 11, 12:23 pm, Nick Fitzsimons n...@nickfitz.co.uk wrote:
 2009/8/11 sak saks...@gmail.com:



  Thats the thing, I don't want the results coming back in order. I am
  trying emulate them coming back unordered, but they are coming back
  ordered. I was digging deeper yesterday and discovered the results are
  linked to an aspsessionid cookie that is created from the asp pages
  (don't fully understand it yet) but through elimination I determined
  if I delete this cookie everytime it is generated, then the AJAX calls
  behave normally - the calls work asyncronously. If the cookie exists
  then the AJAX calls act syncronously which is not what I want. If
  anybody has any experience in this.

 I assume you're using Classic ASP rather than ASP.NET? If so, the
 reason your first (10s) call delays the response to the second (1s) is
 that ASP's session tracking is enabled by default, and its session
 object does not support concurrent access by multiple threads. Thus,
 when the server starts a thread to handle the second (1s) request,
 that thread is blocked waiting for the session object associated with
 your client (via the session cookie) to be released by the first (10s)
 request's thread. So this is just an effect of a limitation in the
 server-side technology, and nothing to do with the browser or jQuery.

 You can disable session tracking for your tests using the
 @ENABLESESSIONSTATE directive:
 http://msdn.microsoft.com/en-us/library/ms525847.aspx.

 Regards,

 Nick.
 --
 Nick Fitzsimonshttp://www.nickfitz.co.uk/


[jQuery] ANNOUNCE: new revs of listnav and listmenu plugins

2009-08-11 Thread Jack Killpatrick


Hi All,

New versions of the jquery listnav and listmenu plugins are now available:

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

What's new:

-- ListNav plugin -

1. added an includeOther option to provide a top level '...' nav link to 
access items that start with chars other than A-Z and 0-9. For example, 
chars like Ä and Ü.


2. added a prefixes option to provide a way to show The New York Times 
under T and N. Pass in your own prefix array.


See the new demo 6 here for examples of both:

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

-- ListMenu plugin ---

1. added an includeOther option, just like the one for the ListNav plugin.

2. added an onClick option that simplifies handling clicks in the 
dropdown menu (for things like pulling an href out of the clicked link 
to use it for an ajax call). The onClick uses event delegation, so is 
low overhead and the clicked object is available as a jquery object in 
your onClick function.


See demo 3 here for includeOther example and demo 6 for onClick example:

   http://www.ihwy.com/labs/demos/current/jquery-listmenu-plugin.aspx


Some of these features were based on user requests. Thanks to everyone 
for the feedback.


- Jack





[jQuery] Re: How to specify a default value...

2009-08-11 Thread Brett Ritter

On Tue, Aug 11, 2009 at 12:10 PM, Rick
Fairclothr...@whitestonemedia.com wrote:
 What I still don't understand is even how this logic works:

 if ( row[19] ) {
 row[19]
 } else {
 N/A
 }

The key part is  if( row[19] ).  row[19] is being evaluated for
_truth_.  Javascript defines (I believe) truth to be non-false, and
false is defined as any of:
undefined
null
0
0  (a string with value zero..I think.  I may be channeling Perl here)
 (empty string)
false (boolean value)

So if you are trying to provide a default value in the case of null
only, then you should check for null because any of the other false
(non-null) values will give you your provided default instead.

The ( test ? return if true : return if false ) construct allows a
full test, so:

( row[19] == null ? default : row[19] ) works.

If you want to look up more about this sort of construct, it's called
the ternary operator and exists in many programming languages.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Re: listmenu

2009-08-11 Thread Jack Killpatrick
Thanks Paul, the new version that I just announced via another email 
takes care of the issue you found and adds some new features. FYI:


http://blogs.ihwy.com/dev/post/New-versions-of-iHwy-listnav-and-listmenu-jQuery-plugins.aspx

- Jack

Paul Speranza wrote:

Jack, yes, the list menu plugin.




On Aug 10, 3:01 pm, Jack Killpatrick j...@ihwy.com wrote:
  

Hi Paul,

Thanks for this info, I'll add it to my test cases and thanks for
letting the community know.

I was actually working on a new version of the plugin yesterday, which
adds one new feature: an onClick option that you can pass a function to
for handling clicks in the dropdown menu. If that's a feature that might
be of interest to you I can get you a copy of the pre-release version.

I'll look into what you reported.

Oh, uh, just to make sure, you're talking about thelistmenuplugin, right?

http://www.ihwy.com/Labs/jquery-listmenu-plugin.aspx

Thanks,
Jack



Paul Speranza wrote:


This may not be a bug in the jQuery List menu widget but if it saves
someone the time it took me to figure it out or the author has an idea
of how to handle this then it is worth it. If the items begin with a
comma - , Paul - it causes the columns in the result to not be
created in IE 7 and the results just show straight down. In Chrome,
Firefox 3.5 and the latest Safari the results do not show at all.
  
I spent a couple of hours tracking this down and I just cleaned up the

data that I was playing with. Maybe the widget can strip off leading
characters that are not letters or numbers.
  
Great widget though!
  
Paul Speranza- Hide quoted text -
  

- Show quoted text -



  




[jQuery] Re: Disable submit button with Validation plugin

2009-08-11 Thread Rich Sturim

thank you Jörn -- that works

On Aug 10, 9:01 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Try this:

 $(document).ready(function() {
    $(#myForm).validate({
      submitHandler: function(form) {
        $(form).find(:submit).attr(disabled, true).attr(value,
 Submitting...);
        form.submit();
     }
   })

 });

 Jörn

 On Mon, Aug 10, 2009 at 9:40 AM, Rich Sturimcosmos99...@gmail.com wrote:
  $(document).ready(function() {
     $(#myForm).validate()
  });




[jQuery] Re: How to specify a default value...

2009-08-11 Thread Rick Faircloth

Thanks, Liam and Brett, for the explanations!

Rick

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Brett Ritter
Sent: Tuesday, August 11, 2009 1:00 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to specify a default value...


On Tue, Aug 11, 2009 at 12:10 PM, Rick
Fairclothr...@whitestonemedia.com wrote:
 What I still don't understand is even how this logic works:

 if ( row[19] ) {
 row[19]
 } else {
 N/A
 }

The key part is  if( row[19] ).  row[19] is being evaluated for
_truth_.  Javascript defines (I believe) truth to be non-false, and
false is defined as any of:
undefined
null
0
0  (a string with value zero..I think.  I may be channeling Perl here)
 (empty string)
false (boolean value)

So if you are trying to provide a default value in the case of null
only, then you should check for null because any of the other false
(non-null) values will give you your provided default instead.

The ( test ? return if true : return if false ) construct allows a
full test, so:

( row[19] == null ? default : row[19] ) works.

If you want to look up more about this sort of construct, it's called
the ternary operator and exists in many programming languages.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org



[jQuery] Re: How to identify if user chose to see secure only or secure and nonsecure items

2009-08-11 Thread James

I've haven't tried Google AdSense before to know much about it, but
I'm wondering if this page is of help to you.
http://nedbatchelder.com/blog/200710/httphttps_transitions_and_relative_urls.html

However, depending on what your purpose is of the secure page (e.g.
login, registration with sensitive info), you might not want to serve
remote ads, which may affect the security of your page, possibly.

On Aug 11, 3:21 am, son sco0...@yahoo.com wrote:
 Hi. I don't know if this is the right place for this question.
 If not, pls let me know where this should be go to.

 My site is secure but also contain non secure items from google
 adsense. users have the options to view secure only or secure and non-
 secure item.

 I would like to be able to identify what that user chose so I can show
 some other things if they choose to only see secure items.

 Any help will be appreciated.

 Son


[jQuery] Re: jQuery not working with content that is loaded in.

2009-08-11 Thread James

Does reloading perform some kind of action that modifies the DOM
(e.g. introduce new content via AJAX). If so, then this FAQ may
explain your problem:
http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F

On Aug 11, 6:03 am, cz231 cz2...@gmail.com wrote:
 Hi,

 I'm building an online application, and I want one widget to refresh
 every time a user clicks a certain element. So I wrote a jQuery on
 click listener that initializes the function to reload the widget.
 However, when the widget is reloaded, all of the javascript effects
 stop working for that widget only. It's like I disabled javascript for
 that part of the page only. Javascript still works everywhere else.

 Can any of you jQuery gurus think of a reason why? (preferably one
 with an easy fix :P)


[jQuery] Re: jQuery not working with content that is loaded in.

2009-08-11 Thread Shane Riley

If you're using the latest jQuery, you can bind most events with .live
() to ensure that your events are attached when the new content is
loaded in. Note that this doesn't work for all events, though.

On Aug 11, 12:03 pm, cz231 cz2...@gmail.com wrote:
 Hi,

 I'm building an online application, and I want one widget to refresh
 every time a user clicks a certain element. So I wrote a jQuery on
 click listener that initializes the function to reload the widget.
 However, when the widget is reloaded, all of the javascript effects
 stop working for that widget only. It's like I disabled javascript for
 that part of the page only. Javascript still works everywhere else.

 Can any of you jQuery gurus think of a reason why? (preferably one
 with an easy fix :P)


[jQuery] Re: how to write a frameset with jquery

2009-08-11 Thread James

Have you tried hard-coding the frameset HTML in the source (not via
Javascript) to see if the page shows up properly?

Also, try using Firebug for Firefox to debug. With Firebug you can
view the HTML as it is even with content dynamically added after page
load.

On Aug 10, 11:31 pm, cokegen coke...@gmail.com wrote:
 Hi, I'm trying to output a frameset and I tried everything but can't
 get it to work. The frameset never appears in the generated html.

 The html and js code is the following:

 index.html

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Frameset//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
         script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
 jquery.min.js type=text/javascript/script
         script src=scripts.js type=text/javascript/script
         meta http-equiv=Content-Type content=text/html; charset=utf-8 /
         titlemy page/title
 /head
 /html

 scripts.js

 $(function() {

         $('html').append('frameset cols=*,31frame src=mainframe.html /

 frame src=otherframe.html //frameset');
 });

 I tried different combinations of prepend(), before(), etc but it's
 the same. I suspect that the frameset should be written before the DOM
 is loaded, but I don't know if it's that or that I basically don't
 understand anything at all :-(

 Could someone point me in the right direction ?

 Thanks in advance


[jQuery] Re: Replace script tag

2009-08-11 Thread James

The way you're doing this looks very unnatural by having the script
tag in the middle of your content.
What exactly are you trying to achieve? Just adding text?

It would be better if you did something like this:

p11span id=lufiCsere()/span22/p

$(function() {
$(#lufi).text('Duma');
});

And if you wanted to add the text to more than one place, consider
using a CLASS instead of ID (which has to be unique on the page).

On Aug 11, 3:14 am, Lay András laysoftjqu...@gmail.com wrote:
 Hello!

 I used this little code to replace some content with jquery:

 script type=text/javascript
 function Csere() {
         $('#lufi').replaceWith('Duma');}

 /script

 p11script type=text/javascript id=lufiCsere()/script22/p

 This works fine, but i'd like to eliminate the id attribute from
 script tag. I tried $(this).replaceWith('Duma'), and
 $(this).parent().replaceWith('Duma'), but neither works. How can I
 solve this?

 Lay


[jQuery] Re: AJAX and JSON

2009-08-11 Thread Joey Derrico
Ok so I have used .ajax function to run my ajax and set type to data. It is
getting (well posting) to a php file that echo's a json_encoded array. When
it returns I am using console.log to display the returned data. when I just
use data it shows the JSON encoded data, but if I use data.key I get
undefined. How can I get it to show me the data from the JSON variable?

Here is the script
$.ajax({ //Begin ajax statement to login file
type:'POST', //It is a Post request
url:'functions/php/login.php', //The login file
datatype:'json', //Return JSON encoded data
data:{ //Data being sent to the server is...
Username:$('#CharacterBuilderUsername').val(), //Username
Password:$('#CharacterBuilderPassword').val() //Password
},
cache:false, //Don't Cache the file
success:function(data){ //if successful
$('#UserBar').load('main_pages/UserBar.php'); //Run an AJAX
request for the user menu
console.log(Data: +data); //Shows Json data: Data:
{PlayerId:1,PlayerName:First Last}
console.log(PlayerId: +data.PlayerId); //Shows undefined
console.log(Player's Name: +data.PlayerName); //Shows
Undefined
var testdata=data.PlayerId;
console.log(Returned Data=+testdata); //shows undefined
},
error:function(XMLHttpRequest, textStatus, errorThrown){ //if
not successful...
$('#CharacterBuilderLoginSubmit').show(0); //show the submit
button
},
});
});

From the PHP file, not the whole script
$UserInfo['PlayerId']=$PlayerId;
$UserInfo['PlayerName']=$PlayerFirstName. .$PlayerLastName;
echo json_encode($UserInfo);


[jQuery] Pagination

2009-08-11 Thread Dave Maharaj :: WidePixels.com
Does anyone know how or if possible to remember where you were at in
pagination?
 
Example a user clicks 1, 2, 3, finds what they want on the third page and
clicks a link...nope not what they were looking for they click back which
now brings them back to pagination page 1 when it would be nice to remember
that they were on the 3rd page and automatically return them there.
 
Dave 


[jQuery] Re: jQuery not working with content that is loaded in.

2009-08-11 Thread cz231

Thanks I think that that is my issue. Is there a way to rebind my
whole javascript file? Or will that affect performance a lot? I ask
because I want pretty much all of my js file pertains to the new
content I'm loading in.

On Aug 11, 1:17 pm, Shane Riley shanerileydoti...@gmail.com wrote:
 If you're using the latest jQuery, you can bind most events with .live
 () to ensure that your events are attached when the new content is
 loaded in. Note that this doesn't work for all events, though.

 On Aug 11, 12:03 pm, cz231 cz2...@gmail.com wrote:

  Hi,

  I'm building an online application, and I want one widget to refresh
  every time a user clicks a certain element. So I wrote a jQuery on
  click listener that initializes the function to reload the widget.
  However, when the widget is reloaded, all of the javascript effects
  stop working for that widget only. It's like I disabled javascript for
  that part of the page only. Javascript still works everywhere else.

  Can any of you jQuery gurus think of a reason why? (preferably one
  with an easy fix :P)


[jQuery] Re: Pagination

2009-08-11 Thread James

I'm assuming a page is a dynamic page with the same URL? For example,
a different layer or content loaded dynamically via AJAX. If that's
the case one way is through the URL hash (e.g. page.html#p3 -
indicates page 3). Every time you change a page, you update the hash
in the URL. If you do a search on jQuery history plugins you'll find a
few.
The nice thing about hashes is that they are stored in the browser
history so technically hitting backspace on your putting with navigate
through the changes in hash.

Another option is saving the page number in a cookie and re-reading it
again on page load and updating your page accordingly to that page
number.

On Aug 11, 9:17 am, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Does anyone know how or if possible to remember where you were at in
 pagination?

 Example a user clicks 1, 2, 3, finds what they want on the third page and
 clicks a link...nope not what they were looking for they click back which
 now brings them back to pagination page 1 when it would be nice to remember
 that they were on the 3rd page and automatically return them there.

 Dave


[jQuery] [autocomplete] trigger event if user rejects all autocomplete otions

2009-08-11 Thread Ash

Does anyone have a library or patch to call a handler if a user leaves
an autocomplete field without choosing one of the autocomplete options
- i.e. they've entered free text.

I'm working with an app that populates multiple fields from a single
auto-complete value, and our latest requirement is to clear out a
bunch of fields if the user's entered something manually - rejecting
autocomplete suggestions.

My initial attempts at hooking into onkeyfoo and onblur haven't lead
anywhere productive, and I'm hoping someone else has managed to
overcome the gnarly event and timing dependencies involved with
onkeyfoo and blur being used for standard autocomplete behaviour.

Note: I'm working with http://plugins.jquery.com/project/autocompletex
- but I'm happy to switch libraries and/or port functionality and
patches over from another solution.


[jQuery] Re: onclick hideSuperfishUl?

2009-08-11 Thread bradoaks

On Aug 5, 11:23 pm, ryantxu ryan...@gmail.com wrote:
 Is there a way to close the superfish dropdown after click?

 I have some 'onclick' functions that kick off some behavior and then
 return false.  How do I get the dropdown to go away?

 I suppose I need to somehow call hideSuperfishUl

 thanks for any pointers!
 ryan

Hi Ryan, I had the same problem.  Here is a solution that worked for
me.

lia onclick=jQuery(this).parent().parent().hide(); other_func();
return false; style=cursor: pointerhide this menu/a/li

but I refactored it to do the hiding in the function I was calling.
in the function definition:
var mypackage = {
add_new_image : function (e, args) {
// do the work of the function
jQuery(e).parent().parent().hide(); // rollup the dropdown
menu
},
}
in the menu:
lia onclick=mypackage.add_new_image(this); style=cursor:
pointeradd image/a/li

That got my menu closing on click instead of waiting for a mouse out.

Good luck,
--bradoaks


[jQuery] iframe not always loading

2009-08-11 Thread sorinh

hi

i have http://www.qualitydesign.ro/test/jquery/ and at the three
button i've inserted an iframe../iframe, but it's loaded only
once, click on the one, two, three and again 1,2,3. what seems
to be the problem?
i'm using jquery-1.2.6.js

thanks.


[jQuery] Error when trying to download jquery

2009-08-11 Thread mrbutler

I receive an error:  'document' is undefined, when I try to run the
jquery download.


[jQuery] Citation for jQuery

2009-08-11 Thread Nathaniel

Hello Devs:

I'm preparing an academic paper in which I want to cite jQuery and
jQuery UI.  Is there a specific publication you would recommend? At
present I've got jQuery Reference Guide by Caffer and Swedberg, but
perhaps there's an article somewhere which is more appropriate?

Just want to give credit where it's due.

--Nathaniel Tagg


[jQuery] ajaxContent plugin and forms

2009-08-11 Thread Cyp3r

Hi,
I'm using ajaxContent plugin with simple forms and I would like to use
it to send password to external script, how to do it like in regular
form (post method, sending data not visible to other users)?

I've set argument Type to POST in script options, but data in ajax
request is still visible (additional positions in href argument).


[jQuery] Embedded JavaScript Not Loading With .load() Call

2009-08-11 Thread Steven

I'm using this code for my website to load pages dynamically:

var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-4)){
var toLoad = hash+'.php #content';
$('#content').load(toLoad)
}
});

$('#nav li a').click(function(){

var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
$('#load').remove();
$('#wrapper').append('span id=loadLOADING.../span');
$('#load').fadeIn('normal');
window.location.hash = 
$(this).attr('href').substr(0,$(this).attr
('href').length-4);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;

});

It works great. However, I'm using a script for tooltips as well -
when I load a page that has links/abbr's that need tooltips, the
JavaScript doesn't run on them. My solution to this was to add a
script in the #content of each page that needed tooltips, except
that doesn't work either.

Can anyone explain this to me? This is a bit frustrating; I may go
back to static pages.


[jQuery] Re: Pagination

2009-08-11 Thread James

Geez, I screwed up on a sentence pretty badly..

so technically hitting backspace on your keyboard will navigate
through the changes in hash.

On Aug 11, 9:43 am, James james.gp@gmail.com wrote:
 I'm assuming a page is a dynamic page with the same URL? For example,
 a different layer or content loaded dynamically via AJAX. If that's
 the case one way is through the URL hash (e.g. page.html#p3 -
 indicates page 3). Every time you change a page, you update the hash
 in the URL. If you do a search on jQuery history plugins you'll find a
 few.
 The nice thing about hashes is that they are stored in the browser
 history so technically hitting backspace on your putting with navigate
 through the changes in hash.

 Another option is saving the page number in a cookie and re-reading it
 again on page load and updating your page accordingly to that page
 number.

 On Aug 11, 9:17 am, Dave Maharaj :: WidePixels.com

 d...@widepixels.com wrote:
  Does anyone know how or if possible to remember where you were at in
  pagination?

  Example a user clicks 1, 2, 3, finds what they want on the third page and
  clicks a link...nope not what they were looking for they click back which
  now brings them back to pagination page 1 when it would be nice to remember
  that they were on the 3rd page and automatically return them there.

  Dave




[jQuery] Re: Embedded JavaScript Not Loading With .load() Call

2009-08-11 Thread James

Are you putting your code in the document ready function?

http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready%28%29

On Aug 11, 6:51 am, Steven html...@gmail.com wrote:
 I'm using this code for my website to load pages dynamically:

         var hash = window.location.hash.substr(1);
         var href = $('#nav li a').each(function(){
                 var href = $(this).attr('href');
                 if(hash==href.substr(0,href.length-4)){
                         var toLoad = hash+'.php #content';
                         $('#content').load(toLoad)
                 }
         });

         $('#nav li a').click(function(){

                 var toLoad = $(this).attr('href')+' #content';
                 $('#content').hide('fast',loadContent);
                 $('#load').remove();
                 $('#wrapper').append('span id=loadLOADING.../span');
                 $('#load').fadeIn('normal');
                 window.location.hash = 
 $(this).attr('href').substr(0,$(this).attr
 ('href').length-4);
                 function loadContent() {
                         $('#content').load(toLoad,'',showNewContent())
                 }
                 function showNewContent() {
                         $('#content').show('normal',hideLoader());
                 }
                 function hideLoader() {
                         $('#load').fadeOut('normal');
                 }
                 return false;

         });

 It works great. However, I'm using a script for tooltips as well -
 when I load a page that has links/abbr's that need tooltips, the
 JavaScript doesn't run on them. My solution to this was to add a
 script in the #content of each page that needed tooltips, except
 that doesn't work either.

 Can anyone explain this to me? This is a bit frustrating; I may go
 back to static pages.


[jQuery] Re: iframe not always loading

2009-08-11 Thread James

Please provide some code as to how you're doing this.
Thanks.

On Aug 11, 4:22 am, sorinh sorin.hodo...@gmail.com wrote:
 hi

 i havehttp://www.qualitydesign.ro/test/jquery/and at the three
 button i've inserted an iframe../iframe, but it's loaded only
 once, click on the one, two, three and again 1,2,3. what seems
 to be the problem?
 i'm using jquery-1.2.6.js

 thanks.


[jQuery] Re: how to write a frameset with jquery

2009-08-11 Thread TPM Media
Delimiters appear to be wrong in sample code.

On Tue, Aug 11, 2009 at 11:18 AM, James james.gp@gmail.com wrote:


 Have you tried hard-coding the frameset HTML in the source (not via
 Javascript) to see if the page shows up properly?

 Also, try using Firebug for Firefox to debug. With Firebug you can
 view the HTML as it is even with content dynamically added after page
 load.

 On Aug 10, 11:31 pm, cokegen coke...@gmail.com wrote:
  Hi, I'm trying to output a frameset and I tried everything but can't
  get it to work. The frameset never appears in the generated html.
 
  The html and js code is the following:
 
  index.html
 
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Frameset//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
  head
  script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
  jquery.min.js type=text/javascript/script
  script src=scripts.js type=text/javascript/script
  meta http-equiv=Content-Type content=text/html;
 charset=utf-8 /
  titlemy page/title
  /head
  /html
 
  scripts.js
 
  $(function() {
 
  $('html').append('frameset cols=*,31frame
 src=mainframe.html /
 
  frame src=otherframe.html //frameset');
  });
 
  I tried different combinations of prepend(), before(), etc but it's
  the same. I suspect that the frameset should be written before the DOM
  is loaded, but I don't know if it's that or that I basically don't
  understand anything at all :-(
 
  Could someone point me in the right direction ?
 
  Thanks in advance


[jQuery] Tablesorter with rowspan applied to a table cell?

2009-08-11 Thread J. Martin

While sorting a table with the Tablesorter plugin, I'd like to have a
table cell within an interior column use the rowspan attribute (the
result being this column has only a single value). I can't figure out
how to use it however. The docs I saw (http://lovepeacenukes.com/
tablesorter/2.0/docs/) go over using rowspan within table headers, but
I don't see info on rowspan with table cells.

Below is some example code with only two rows. One row has a
rowspan=2 for the Email cell, and the other's email cell is
commented out. Sorting only works properly when the table is sorted
such that the rowspan=2 cell is listed first - otherwise the rowspan
attribute is applied on the row that cell is now listed at, rather
than at the first row, where I'd like it.

What is the proper way to use rowspan within a table?

PS - Is the jQuery Plugins mailing list still actively moderated?

-
table id=myTable class=tablesorter
thead
tr
   thLast Name/th
   thFirst Name/th
   thEmail/th
   thDue/th
   thWeb Site/th
/tr
/thead
tbody
tr
   tdSmith/td
   tdJohn/td
   td rowspan=2jsm...@gmail.com/td
   td$50.00/td
   tdhttp://www.jsmith.com/td
/tr
tr
   tdBach/td
   tdFrank/td
   !--tdfb...@yahoo.com/td--
   td$50.00/td
   tdhttp://www.frank.com/td
/tr
/tbody
/table


[jQuery] Change bg image on hover

2009-08-11 Thread sammahoney

Hi guys

I have a dropdown menu. When the dropdown is hovered, I need a bg
image to show, then slowly fade out when the mouse leaves. I wrote
this little script for it:

var $j = jQuery.noConflict();

$j(function(){

    $j(#dropdown-nav li ul li).mouseover(function(){
                $j(this).stop().before('li class=hoverbg/li');

    }),

$j(#dropdown-nav li ul li)
.mouseleave(function(){
$j(#dropdown-nav li ul 
li.hoverbg).stop().fadeOut(300, function()
{
  $j(this).remove();
});
                    })
});

So it adds an extra li above the one being hovered (which via css is
positioned absolutely so the next li displays over the top). Anyways,
it works fine, but sometimes when hovering it adds 2 or 3 li's in
there. I thought the stop() would sort that, but it hasn't.

Any ideas why that's happening? And could this be written better? It's
one of my first attempts with jQuery so go easy on me!


[jQuery] Re: HTML5 video tag available?

2009-08-11 Thread Ricardo

1. try giving it an ID
2. try doing what Liam said, *before* you create the element. That's a
hack that 'forces' the browser to acknowledge the existence of the tag
3. it helps if you make sure your page is in standards mode

On Aug 11, 7:01 am, quiKe ponuntamaentuv...@gmail.com wrote:
 Hi again.

 But i insert the video tag into the code:

                     for (var j = 0; j  bloque.video.length; j++) {
                         Bloque += 'li id=' + j + ' video src=' +
 bloque.video[j].ruta + ' alt=' + bloque.video[j].alt + '
 controls=' + bloque.video[j].controls + '  autoplay=' + bloque.video
 [j].autoplay + ' //li';
                     }

 So the video tag is in the DOM. The problem is jquery doesn´t
 recognize the tag, so you can not control it as a img tag for example
 (for searchs, manipulation...). Any idea to how to do it?.

 Thanks.

 On Aug 7, 3:30 pm, Liam Potter radioactiv...@gmail.com wrote:

  try adding

  document.createElement(video);

  before your jquery script

  quiKe wrote:
   tried (doesn´t work) but i wanted to know if maybe i was on a mistake.

   On Aug 7, 12:52 pm, Liam Potter radioactiv...@gmail.com wrote:

   try it?

   quiKe wrote:

   Hi, do you know if it is possible to use selectors for a video tag?
   For example:
   $(this).find('div.misc').find('ul').addClass('thumb-fila').find
   ('li').find('video').each(function(){
   });

   to capture the video tags on a li?

   Thanks


[jQuery] Re: Change bg image on hover

2009-08-11 Thread sammahoney

I should add that if I use mouseenter, it fixes the problem, but then
for some reason my dropdowns parent won't stay active, whereas it will
on mouseover.

On Aug 11, 10:08 pm, sammahoney samom...@gmail.com wrote:
 Hi guys

 I have a dropdown menu. When the dropdown is hovered, I need a bg
 image to show, then slowly fade out when the mouse leaves. I wrote
 this little script for it:

 var $j = jQuery.noConflict();

 $j(function(){

     $j(#dropdown-nav li ul li).mouseover(function(){
                 $j(this).stop().before('li class=hoverbg/li');

     }),

         $j(#dropdown-nav li ul li)
                 .mouseleave(function(){
                         $j(#dropdown-nav li ul 
 li.hoverbg).stop().fadeOut(300, function()
 {
                                       $j(this).remove();
                                                 });
                     })

 });

 So it adds an extra li above the one being hovered (which via css is
 positioned absolutely so the next li displays over the top). Anyways,
 it works fine, but sometimes when hovering it adds 2 or 3 li's in
 there. I thought the stop() would sort that, but it hasn't.

 Any ideas why that's happening? And could this be written better? It's
 one of my first attempts with jQuery so go easy on me!


[jQuery] A complicated menu. Need some help.

2009-08-11 Thread suntrop

My navigation menu is quite complicated and I can't get it working.
Can someone please help?

That's what I want and have until now:

A nested UL menu that slides to the left if I click a link with sub-
menus and fade in the sub-menu.
(sub-menus are not displayed by default via css)

ul id=navigation
liHome/li
lispanProducts/span
ul class=level2
liProduct A/li
lispanProduct B/span
ul class=level3
liProduct B Info/li
/ul
/li
liProduct C/li
/ul
/li
lispanTeam/span
ul class=level2
liBoss/li
liSales Team/li
liBob/li
/ul
/li
liContact/li
/ul

jQuery:
$(#navigation span).click(function () {
// move the whole ul#navigation 100px to the left
$(this).parent().parent().animate({left:'-100px'},'slow');
// … and show the first submenu level2 (links products a-c)
$(this).next.show();

// but how can I 'see' if it is a nested span I click on and move
#navigation and the nested ul?
   // and maybe the #navigation the nested ul and another nested
ul?
});


Thanks a million for any help!!


[jQuery] Re: $ajax() question

2009-08-11 Thread yi

Thanks Jules
that is really helpful.
thank you so much!!!
I konw what i am going to do now!!!

On Aug 11, 9:53 pm, Jules jwira...@gmail.com wrote:
 After re-reading the original post, it seems json is not required

 just use
 data:Args=+args2

 on the server side

 StreamReader reader = new StreamReader(Request.InputStream);

 string param = reader.ReadToEnd();

 param = Args=abc assuming args2=abc

 Just use split() to get the value.

 On Aug 11, 1:59 pm, Jules jwira...@gmail.com wrote:

  JavaScriptSerializer is included in AJAX 1.0. It is compatible
  with .NET 2.0.

 http://www.asp.net/ajax/downloads/archive/

  You don't have to use the ajax component on your client to use it.

  On Aug 11, 1:18 pm, yi falconh...@gmail.com wrote:

   Hi Jules:
   If i use old version of ASP.net, Can i Deserialize Json data?

   thanks Jules!!!

   On Aug 11, 3:01 pm, Jules jwira...@gmail.com wrote:

Opps,
You are right, change the contentType to

contentType: application/json; charset=utf-8

here is a snippet to handle generic json in C# .NET 3.5

JavaScriptSerializer ser = new JavaScriptSerializer();
StreamReader reader = new StreamReader(Request.InputStream);
object input = ser.DeserializeObject(reader.ReadToEnd());
string args = ((Dictionarystring, object)input)[Args] as string;

or if you have the object defined use

System.Runtime.Serialization.Json.DataContractJsonSerializer

More info in

   http://www.west-wind.com/WebLog/posts/218001.aspx

On Aug 11, 12:23 pm, yi falconh...@gmail.com wrote:

 hi Jules:
 I use Request(Arg) , but it doesn't work. it always give me empty
 string
 contentType: text is it right?
 do i need make it  contentType: Json,  ?
 If i need use JSON, do you know how to read json data at sever side in
 asp.net?
 thanks so much!!!

 On Aug 11, 12:50 pm, Jules jwira...@gmail.com wrote:

  Use Request(Arg) instead, this syntax gets the Arg from data post 
  or
  querystring.
  Do not enclose args2, the server will get args2 instead of the 
  value
  of args2.

  data:{Arg:args2}

  On Aug 11, 10:12 am, yi falconh...@gmail.com wrote:

   Hi Jules:
   thank you for your help!!
   if I use this:

   type: POST,
   url: mywebpage.aspx,
   data:{Arg:args2}

   Do you know how can i get value of arg from sever side(code 
   behind)? I
   use asp.net, but i dont know how to fatch data when data put 
   inside
   {},  data:{Arg:args2} 
   Can i still use Request.QueryString() function?

   thanks

   On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote:

There is a limit on url length depending on the browser.

   http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g...

use type:POST and data: instead and do not enclose the object
declaration

data:{Arg:args2} instead of  data:{Arg:args2}

On Aug 11, 8:41 am, yi falconh...@gmail.com wrote:

 $.ajax({

                                         type: POST,

                                         url: mywebpage.aspx?
 Arg=+args2,

                                         contentType: text,

                                         data:{},

                                         dataType: text,

                                         success: 
 CompleteInsert,

                                         error: onFail

                                 });

 I dont know why the onFail function is going to be executed 
 when args2
 is too big.
 args2 is a string type
 can anyone explain this
 thanks


[jQuery] Re: $ajax() question

2009-08-11 Thread yi

OK I will try object of key/value pairs.
You mean i should use data:{Arg:args2} . is it right?

On Aug 12, 4:05 am, Stephan Beal sgb...@googlemail.com wrote:
 On Aug 11, 11:53 am, Jules jwira...@gmail.com wrote:

  After re-reading the original post, it seems json is not required

  just use
  data:Args=+args2

 Don't do that. If args2 contains any invalid characters (i.e. a space)
 then this will fail, possibly in mysterious ways. Always send the data
 as an object of key/value pairs, and let the jquery internals escape
 it for you.


  1   2   >