[jQuery] jQuery 1.4 change event problem

2010-01-19 Thread Steven Yang
Hi all

I apologize if this problem has been post or report.

I have a problem using jQuery 1.4 when i use
$(#mySelect).change(function(){...my logic...})

This problem only occurs in IE. 6-8 all have the same problem and jQuery
1.3.2 does not have this problem.

This problem occurs when I bind a change event on a select and when the
page is loaded the selected option is not the first one.
What will happen is when I click on the select and not even have a chance to
choose my option, the change event is fired. But after the first change,
things works normally.

i made a simple sample here:
http://jsbin.com/apufa/ http://jsbin.com/apufa/edit

you will notice when you click on the select the alert will fire, but it
should only be fired when i actually change the option.

is this a bug?

Thanks


[jQuery] Re: jQuery 1.4 upgrade + env.rhino.js + blue-ridge

2010-01-19 Thread Steven Parkes
You may want to post to the blue ridge list. I just checked the sample
app and it doesn't work with 1.4, though it gives an error rather than
not just running the specs. I tried updating the env.js that blue
ridge bundles and that fails in a completely different way ... but,
then, so does the 1.3.2 port, so blue ridge needs some sort of update
to run with the newest env.js. I can look at the env.js stuff once
that happens.

I'm using 1.4 in a non-blue-ridge/non-screw-unit app and haven't run
into any incompatibilities yet ... but, then, I also use the Ruby/
SpiderMonkey port of env.js rather than the Rhino version, so that's a
difference, too.


Re: [jQuery] Re: jQuery 1.4 change event problem

2010-01-19 Thread Steven Yang
sorry not too sure what you have concluded here.
so do you mean after you do the select by code, the problem is solved? or
still occurs?

and is this a problem that jQuery may be responsible to handle or are we
suppose to handle ourselves?
i was already forced to downgrade back to 1.3.2 because of this, because we
do a lot of submit onchange.

thanks

On Tue, Jan 19, 2010 at 10:11 PM, Bruno Santos bit...@gmail.com wrote:

 Indeed, the problem is related to the selected option not to the be the
 first one, on the first time the object is *clicked*.

 The problem is not exactly the selected parameter written on the body,
 but the currently selected option in runtime.
 To verify that, just add an onload event to body, and set the selected
 option by code.
 The *$(document).ready* code is run and binds the event *before* the *
 onload* function is called to set the selection.
 And yet the problem occurs:


 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
 head
 meta http-equiv=Content-type content=text/html; charset=utf-8
 /
 titleSandbox/title
 style type=text/css media=screen
 body { background-color: #000; font: 16px Helvetica, Arial;
 color: #fff; }
 /style
 script type=text/javascript src=
 http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js;/script
 script type=text/javascript
 function setsecond(){
 mySelect.options.item(1).selected = true;  // IE only code

 }
 $(document).ready(function(){
 $(#mySelect).change(function(){
 alert($(this).find(option:selected).val());
 });
 });
 /script
 /head
 body onload=javascript:setsecond()

 select id=mySelect
 option value=1Value 1/option
 option value=2Value 2/option
 /select
 /body
 /html



 2010/1/19 David Statler statler.da...@gmail.com

 I made a quick mock up of this to try to find the problem. As you have both
 stated, the problem only occurs in IE (I only tried it on IE6). However, I
 rewrote the following and this works on IE6. The problem seems to occur when
 you add selected=selected to the second option value.



 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
 head
 meta http-equiv=Content-type content=text/html; charset=utf-8
 /
 titleSandbox/title
 style type=text/css media=screen
 body { background-color: #000; font: 16px Helvetica, Arial;
 color: #fff; }
 /style
 script type=text/javascript src=
 http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js;/script
 script type=text/javascript
 $(document).ready(function(){
 $(#mySelect).change(function(){
 alert($(this).find(option:selected).val());
 });
 });
 /script
 /head
 body
 select id=mySelect
 option value=1Value 1/option
 option value=2Value 2/option
 /select
 /body
 /html




 On Tue, Jan 19, 2010 at 6:06 AM, pambuk wojtek.zymo...@gmail.com wrote:

 Same here, would love to hear an answer.

 On Jan 19, 11:00 am, Steven Yang kenshin...@gmail.com wrote:
  Hi all
 
  I apologize if this problem has been post or report.
 
  I have a problem using jQuery 1.4 when i use
  $(#mySelect).change(function(){...my logic...})
 
  This problem only occurs in IE. 6-8 all have the same problem and
 jQuery
  1.3.2 does not have this problem.
 
  This problem occurs when I bind a change event on a select and when
 the
  page is loaded the selected option is not the first one.
  What will happen is when I click on the select and not even have a
 chance to
  choose my option, the change event is fired. But after the first
 change,
  things works normally.
 
  i made a simple sample here:http://jsbin.com/apufa/
 http://jsbin.com/apufa/edit
 
  you will notice when you click on the select the alert will fire, but
 it
  should only be fired when i actually change the option.
 
  is this a bug?
 
  Thanks






Re: [jQuery] Re: jQuery 1.4 LiveQuery

2010-01-15 Thread Steven Yang
Jon what version of blockUI are you using? I think i just ran into similar
problem yesterday when i upgraded jQuery to 1.4 and blockUI stopped working.
but i solved it by upgrading blockUI to the newest version then everything
worked again. i think the newest version was updated some time in Jan 2010

On Fri, Jan 15, 2010 at 10:00 PM, Dave Methvin dave.meth...@gmail.comwrote:

  In 1.4 the built in live() function has been heavily extended, so
  perhaps you can switch to using that instead?

 Agreed, but I think livequery should still work. The error posted
 there is in blockUI and not livequery anyway. Jon Bennett, can you put
 up a simple page that is a complete test case? It will probably be
 simple to diagnose using Firebug.



Re: [jQuery] Re: Go through XML nodes only 1 level deep

2010-01-06 Thread Steven Yang
just making sure

you are not able to parse the xml at all right?
i believe for IE you have to make sure you server returns the correct
content type like text/xml to client inorder for you to parse

hope this help

On Thu, Jan 7, 2010 at 9:30 AM, Jules jwira...@gmail.com wrote:

 For some reason, it works on firefox (3.5.6) and doesn't work in ie
 6.0 and 8.0

 On Jan 7, 6:39 am, Frank Peterson fictionalper...@gmail.com wrote:
  I'm grabbing an XML file with jQuery like this:
 
  $(document).ready(function(){
  $.ajax({
  type: GET,
  url: http://ipinfodb.com/ip_query.php?ip=74.125.45.100;,
  dataType: xml,
  success: function(xml) {
  //$(xml).find().each(function(){
  var city = $(xml).find(City).text();
  /*
  $('div class=items id=link_'+id+'/div').html
  ('a href='+url+''+title+'/a').appendTo('#page-wrap');
  $(this).find('desc').each(function(){
  var brief = $(this).find('brief').text();
  var long = $(this).find('long').text();
  $('div class=brief/div').html(brief).appendTo
  ('#link_'+id);
  $('div class=long/div').html(long).appendTo
  ('#link_'+id);
  });
  */
  alert(city)
  //});
  }
  });
 
  });
 
  The XML file looks like this
  ?xml version=1.0 encoding=UTF-8?
  Response
  Ip74.125.45.100/Ip
  StatusOK/Status
  CountryCodeUS/CountryCode
  CountryNameUnited States/CountryName
  RegionCode06/RegionCode
  RegionNameCalifornia/RegionName
  CityMountain View/City
  ZipPostalCode94043/ZipPostalCode
  Latitude37.4192/Latitude
  Longitude-122.057/Longitude
  Timezone-8/Timezone
  Gmtoffset-8/Gmtoffset
  Dstoffset-7/Dstoffset
  /Response
 
  But I can't get it to pull the data out.



[jQuery] Anchor Child Not Responding to Hover

2010-01-02 Thread Steven
I have the following markup:

a href=# id=closespan/span/a

The span is hidden by CSS. I then have the following jQuery code:

// Hook close button hover
$('a#close').hover(
function(){
$('span',this).fadeIn();
},
function(){
$('span',this).fadeOut();
}
);

This does work only when the child span is displayed (not hidden via
CSS) by default. If the span is hidden, it doesn't do anything. I'm
tearing my hair out over this. I've rewritten those 8 lines over and
over, so I'm pretty sure it's not syntactical. Just for kicks, here is
the CSS:

div#toolbar a#close
{
display: block;
float: right;
width: 48px;
height: 100%;
background: transparent url('close.png') center center no-repeat;
margin-top: -10px;
}
div#toolbar a#close span
{
display: block;
width: 100%;
height: 100%;
background: transparent url('close_hover.png') center center no-
repeat;
display: none;
}


[jQuery] Re: Anchor Child Not Responding to Hover

2010-01-02 Thread Steven
I solved it by hiding the span with hide() rather than CSS. Although
I'd like to know why straight CSS breaks this while adding
display:none; via JavaScript works fine.


[jQuery] $('a:link') Selector?

2009-10-17 Thread Steven

Hello,

I'm trying to make a basic, dynamic link color fader. Since I have
multiple link colors for different classes and divisions and such, I'm
trying to make it dynamic. To do so I need to grab the original
color and the hover color. Here is my code:

// Fading links
$('a').hover(
// Over
function(){
var original_cl = $('a:link',this).css('color');
var fade_cl = $('a:hover',this).css('color');
alert('Original color: '+original_cl+'; Fade color: '+fade_cl);
},
// Out
function(){

}
);

Both colors come as undefined; experimentation tells that using
a:link or a:hover as the selector is invalid. How can I grab these
colors in context?

Thanks,
Steven


[jQuery] accessing a microsoft reporting table css classes

2009-10-09 Thread Steven Maglio
A co-worker and I have been trying to use jQuery to get access to frameset
frames within an iframe (that sounds awkward). He created a stackoverflow
question about it, but I thought this mailing list might have a greater
knowledge the problem space.

There is a screen shot link posted in the answers section (I don't have
enough points to update the question).

http://stackoverflow.com/questions/1541140/accessing-a-microsoft-reporting-table-css-classes-using-jquery

Any help you can give would be appreciated.

-- 
Steven Maglio
smagli...@gmail.com
twitter: http://twitter.com/smaglio81
linkedin: http://www.linkedin.com/in/stevenmaglio
tech-blog: http://stevenmaglio.blogspot.com/


[jQuery] Multiple Links, Find which one was clicked?

2009-09-24 Thread Steven

I have a table that looks something like this:

tr id=1
 tdName/td
 tdE-Mail/td
 tda href=# class=acceptAccept/a - a href=#
class=denyDeny/a/td
/tr

With multiple rows. Each row has a unique ID (numerical). I need to be
able to click on an a.accept, find WHICH one was clicked (which row it
is in), and get the ID of that row. I've been looking around and I
found parent(), but I'm not sure how I can specifically get which
accept link was clicked.

Can anyone help?


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Steven

I cannot seem to get that to work, although it does make sense. I'm
using Ajax to load the tables in; I don't know if that is the cause. I
did try it on a static page and it still did nothing though.

On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
wrote:
 $('a.accept').click(function() {
     alert($(this).closest('tr').attr('id'));

 --
 Charlie Grieferhttp://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Steven

I was running on 1.2 for some reason. :( Anyway, it works perfectly on
static pages, but when I load the table in via Ajax none of the links
are bound. I'm doing:
// Click events to load requests
$('#pending').click(function(){
$('#list').hide(600).load('list.php',{type: 
'pending'}).show(600);
$('#description').html(pending);
});
To load the tables.

On Sep 24, 12:59 pm, Charlie Griefer charlie.grie...@gmail.com
wrote:
 Steven:

 It seems to be working here (quick sample thrown together):

 http://charlie.griefer.com/getRowID.html

 ?



 On Thu, Sep 24, 2009 at 11:55 AM, Steven html...@gmail.com wrote:

  I cannot seem to get that to work, although it does make sense. I'm
  using Ajax to load the tables in; I don't know if that is the cause. I
  did try it on a static page and it still did nothing though.

  On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
  wrote:
   $('a.accept').click(function() {
       alert($(this).closest('tr').attr('id'));

   --
   Charlie Grieferhttp://charlie.griefer.com/

   I have failed as much as I have succeeded. But I love my life. I love my
   wife. And I wish you my kind of success.

 --
 Charlie Grieferhttp://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Steven

Awesome, I've never heard of or used live() before. Seems handy!
Thanks!

On Sep 24, 1:07 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
 Ah, yeah.  I should have checked to see if you were on 1.3.

 Assuming you can move up to 1.3, you can use the live() method (now
 built-in).

 I think you'd be able to get by changing your first line to:

 $('#pending').live('click', function({





 On Thu, Sep 24, 2009 at 12:05 PM, Steven html...@gmail.com wrote:

  I was running on 1.2 for some reason. :( Anyway, it works perfectly on
  static pages, but when I load the table in via Ajax none of the links
  are bound. I'm doing:
         // Click events to load requests
         $('#pending').click(function(){
                 $('#list').hide(600).load('list.php',{type:
  'pending'}).show(600);
                 $('#description').html(pending);
         });
  To load the tables.

  On Sep 24, 12:59 pm, Charlie Griefer charlie.grie...@gmail.com
  wrote:
   Steven:

   It seems to be working here (quick sample thrown together):

  http://charlie.griefer.com/getRowID.html

   ?

   On Thu, Sep 24, 2009 at 11:55 AM, Steven html...@gmail.com wrote:

I cannot seem to get that to work, although it does make sense. I'm
using Ajax to load the tables in; I don't know if that is the cause. I
did try it on a static page and it still did nothing though.

On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
wrote:
 $('a.accept').click(function() {
     alert($(this).closest('tr').attr('id'));

 --
 Charlie Grieferhttp://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love
  my
 wife. And I wish you my kind of success.

   --
   Charlie Grieferhttp://charlie.griefer.com/

   I have failed as much as I have succeeded. But I love my life. I love my
   wife. And I wish you my kind of success.

 --
 Charlie Grieferhttp://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.


[jQuery] Re: [Attrib external not working...]

2009-09-20 Thread Steven Yang
trya href=http://www.google.com;google/a

On Sun, Sep 20, 2009 at 7:25 PM, Lord Gustavo Miguel Angel 
goosfanc...@gmail.com wrote:

  Hi,

 Why this code not working?

 a rel=external href=www.google.comgoogle/a

 url www.google.com open in same windows.


 Thank´s



[jQuery] Re: ajax xml question

2009-09-18 Thread Steven Yang
I think you might have to check the encoding that google is usingI think
google should be using UTF-8. check the encoding on your side.

On Fri, Sep 18, 2009 at 2:11 PM, David .Wu chan1...@gmail.com wrote:


 But I got one more question
 http://www.google.com/ig/api?hl=zh-twweather=Changhua
 This is the weather condition that response by my language, and the
 value become garbage characters exclude English, any solution?

 On 9月18日, 下午2時06分, David .Wu chan1...@gmail.com wrote:
  terrific!!! thanks a lot
 
  On 9月17日, 下午5時57分, lanxiazhi lanxia...@gmail.com wrote:
 
   specify content type to xml:
 
   header(Content-type: text/xml);
   if ($_GET['weather']) {
   ...



[jQuery] Re: Browser sniffing - the correct way?

2009-09-17 Thread Steven Yang
AFAIK $.broswer is not the way to go in latest jQuery is simply because
browser sniffing is not recommended and not the jQuery way of getting things
work cross all browsers.and not that because $.browser has problem itself

it really depend on why you need to know the different browsers. jQuery
recommends feature detection in contrast to browser sniffing

all i can think of the only reason to use browser sniffing is to solve the
IE6 select problem.
of course i maybe wrong

On Thu, Sep 17, 2009 at 7:09 PM, ldexterldesign
m...@ldexterldesign.co.ukwrote:


 Is conditional comments in the header my only way out of this?

 ldexterldesign wrote:
  Easy guys,
 
  I wondered if anyone would be kind enough to point me in the direction
  of a good browser detection script/plug-in/tool? I've heard/read
  jQuery.browser isn't the way to go with the latest jQuery (v.1.3.2).
 
  The cause really doesn't warrant setting it up server-side if I'm
  honest.
 
  Thanks,
  L



[jQuery] Re: selecting elements that match a regular expression

2009-09-16 Thread Steven Black

Try James Padolsey's Regex Selector plugin for jQuery
 http://james.padolsey.com/javascript/regex-selector-for-jquery/

**--**  Steve

On Sep 16, 9:34 pm, macsig sigbac...@gmail.com wrote:
 Hello guys,
 is there a way to select elements that match a regular expression?

 I have a set of divs with id = wrap_n where n is a progressive and I
 need to select them and for each 1 I have to add a function that
 togggle the elem_n div.

 Thanks

 Sig


[jQuery] append script in ajax cross domain on success function is not working.(script not excuting)

2009-09-15 Thread steven

Hi everyone, i recently tried to get some script off a remote server
through ajax. After days of searching and trying, i finally had it
working apart from appending the script inside the success function of
the ajax call, but the append script works outside of the ajax
function with a little hack(set up a delay)  I have the code shown
below with more explaination.
code
   /*in page header/
  var flashHTML;
  $.ajax({
  url: crossdomainURL,
  data: { 'ClientID': '100', 'CatID': '11',
'LessonID': null, 'ClientUserID': null },
  contentType: application/json; charset=utf-8,
  dataType: jsonp,
  success: function(data, textStatus) {
  //alert(data);
  //alert(data.d);//NOTE: i can get the return
data here.
  //alert(JSON.stringify(data));
  flashHTML = data.d;
  //$(#flash).append(flashHTML);  //Note: if I
uncomment this line here, the html part of the flashHTML
  //
will be shown on the page but the script will not excute.
  },
  error: function(err) {
  alert(errr);
  }
  });

  /*in page body/
  body 
  form id=form1 runat=server

  div id=flash/div

  script language=javascript type=text/javascript
  setTimeout(showFlash(), 500);// Setup a time
delay, because the flashHTML is obtained from an ajax call, it will
NOT
// be
rdy without the delay.
  function showFlash() {
  $(#flash).append(flashHTML);   // If i append the
flashHTML here, the script inside the flashHTML will be excuted.
 // if
i comment this out and put it inside the success function of the ajax
call, it doesn't
 //
work.
  }
  /script
 /form
 /body
/code

does anyone know whats the problem is? any help will be appreciated.
Thanks.
PS: i tried to set the ajax call the async: false, but it doesn't
work. I am not sure whether its a bug or what, but set async to false
doesn't have any effect on how the ajax function behaved.


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Steven Yang
i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
jquery-1.3.2.js

and also putting ui.core.js before ui.datepicker.js


On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:


 Hi,

 I'm getting Javascript error object expectedon PageLoad at the
 following line:

 $(document).ready(function()

 I found that  alert(typeof $); is returing undefined.

 Below is the code snippet:

  script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery-1.3.2.js type=text/javascript
 language =javascript/script
script src=../../Scripts/jquery.validate.min.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery.metadata.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.datepicker.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.core.js type=text/javascript
 language =javascript/script

 script type=text/javascript language =javascript
alert(typeof $);
$(document).ready(function() {
$(#FromDate).datepicker();

});

 Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Steven Yang
hum...
how about just try loading the jquery-1.3.2.js first and see if you get the
$ as an Object
and if that works then try loading one after another and see which one is
having error.

On Tue, Sep 15, 2009 at 6:54 PM, Vardhini vardhini...@gmail.com wrote:


 Thanks for the response..I tried ..both no luck..

 On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
  i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
  jquery-1.3.2.js
 
  and also putting ui.core.js before ui.datepicker.js
 
  On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:
 
   Hi,
 
   I'm getting Javascript error object expectedon PageLoad at the
   following line:
 
   $(document).ready(function()
 
   I found that  alert(typeof $); is returing undefined.
 
   Below is the code snippet:
 
script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery-1.3.2.js type=text/javascript
   language =javascript/script
  script src=../../Scripts/jquery.validate.min.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery.metadata.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.datepicker.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.core.js type=text/javascript
   language =javascript/script
 
   script type=text/javascript language =javascript
  alert(typeof $);
  $(document).ready(function() {
  $(#FromDate).datepicker();
 
  });
 
   Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] Re: Easy show()/hide() Question

2009-09-15 Thread Steven Black

The problem is synchronicity.  When you add an animation (like slow
or fast) the animation process starts but, behind the scenes,
subsequent lines of javascript continue to execute during the
animation.

When you need things in strict order, and you have an animation, use
the callback, which will fire once the animation is complete.

In other words, use show(speed, callback) and hide(speed, callback).

**--**  Steve





On Sep 10, 10:18 am, GLSmyth george.sm...@gmail.com wrote:
 I am missing something fundamental and am sure that someone can point
 me in the right direction.

 I have a list like so:

     li id=GalleryMenua href=../Gallery/Default.htmDD/a
       ul class=DoNotDisplay
         lia href=../Gallery/Santuary.htmSantuary/a/li
         lia href=../Gallery/Stream.htmStream/a/li
         lia href=../Gallery/Winter.htmWinter/a/li
       /ul
     /li

 I have styled it so that the list items float.  The class DoNotDisplay
 hides the unordered list.  When the mouse hovers over GalleryMenu then
 jQuery removes the DoNotDisplay class so that the unordered list is
 displayed, moving off GalleryMenu hides the list.  This works fine and
 the code is:

 $(document).ready(
   function() {
     $('li#GalleryMenu').add('li#PoemMenu').hover(
       function() {
         $(this).children('ul').removeClass('DoNotDisplay');
       },
       function() {
         $(this).children('ul').addClass('DoNotDisplay');
       }
     );
   }
 );

 I would like the unordered list to slide open, so I changed the code
 to:

 $(document).ready(
   function() {
     $('li#GalleryMenu').add('li#PoemMenu').hover(
       function() {
         $(this).children('ul').show('fast');
         console.log('Open list');
       },
       function() {
         $(this).children('ul').hide('fast');
         console.log('Close list');
       }
     );
   }
 );

 The list opens properly, but does not close when I move the mouse from
 the list.  When looking at this in Firebug I see that 'hide' is
 firing, but for some reason does not close the list.  If I unfloat
 the list then the code works just fine.

 What am I missing?  I'm sure that it is staring me in the face, but I
 am just not seeing it.  The full code can be found 
 athttp://glsmyth.com/Sedwick/Templates/

 Thanks for looking.

 Cheers -

 george


[jQuery] Re: append script in ajax cross domain on success function is not working.(script not excuting)

2009-09-15 Thread steven

sry about the format, i ll paste it again and make it easy to read.
PS: i think i know why it isn't working, i suspect after the success
ajax call, the page has already been loaded, and append
script to flash div didn't actually run the script. now i am
wondering, is it possible to get some script from server response and
execute the script after the page has been loaded?? any help will be
appreciated.

code
   /*in page header/
  var flashHTML;
  $.ajax({
  url: crossdomainURL,
  data: { 'ClientID': '100', 'CatID': '11',
'LessonID': null, 'ClientUserID': null },
  contentType: application/json; charset=utf-8,
  dataType: jsonp,
  success: function(data, textStatus) {
  //alert(data);
  //alert(data.d);//NOTE: i can get the return
data here.
  //alert(JSON.stringify(data));
  flashHTML = data.d;
  //$(#flash).append(flashHTML);  //Note: if I
uncomment this line here, the html part of the flashHTML
  //
will be shown on the page but the script will not excute.
  },
  error: function(err) {
  alert(errr);
  }
  });
  /*in page body/
  body 
  form id=form1 runat=server
  div id=flash/div
  script language=javascript type=text/javascript
  setTimeout(showFlash(), 500);// Setup a time
delay, because the flashHTML is obtained from an ajax call, it will
NOT
// be
rdy without the delay.
  function showFlash() {
  $(#flash).append(flashHTML);   // If i append the
flashHTML here, the script inside the flashHTML will be excuted.
 // if
i comment this out and put it inside the success function of the ajax
call, it doesn't
 //
work.
  }
  /script
 /form
 /body
/code


[jQuery] Re: Ajax

2009-09-15 Thread Steven Yang
your first link works find
the second one doesnt work because you have the wrong id on your a
and the id is the same as your div



On Tue, Sep 15, 2009 at 7:05 PM, Matthew Rolph marine.ro...@gmail.comwrote:

 well, i fixed that at least the source shows right now
 can you see any probs. now?


 On Mon, Sep 14, 2009 at 9:15 PM, Steven Yang kenshin...@gmail.com wrote:

 hi
 this is all i see in the source of your page

  !DOCTYPE html html head titleAjax - jQuery Tests/title script
 src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;
 /script style

 i dont think its complete. Might be something wrong on your serverside
 program.

 On Tue, Sep 15, 2009 at 9:02 AM, Matt marine.ro...@gmail.com wrote:


 I made a page that would load 2 html pages, had a footer to show both,
 2 links to show indivually, the divs to load them in, and the sticky
 footer css. My js seems valid, but the page is just completely blank.
 URL: http://testingspot.hostcell.net/sandbox/tests/jquery/ajax/ajax.html






[jQuery] Re: Intercept javascript event

2009-09-14 Thread Steven Black

One idea: have a look at the Aspect Oriented Programming plugin.

See http://plugins.jquery.com/project/AOP
and http://code.google.com/p/jquery-aop/

If this isn't exactly what you are looking for, then therin is code to
pre- and post-hook existing events.

I hope this helps.

**--**  Steve


On Sep 14, 1:05 pm, sirrocco xavier...@gmail.com wrote:
 Here's what I'm trying to do :

 I have a page with some links. Most links have a function attached to
 them on the onclick event.

 Now, I want to set a css class to some links and then whenever one of
 the links is clicked I want to execute a certain function - after it
 returns , I want the link to execute the onclick functions that were
 attached to it.

 Is there a way to do what I want ?

 Here's an attempt at an example :

 $(#link).click(function1);
 $(#link).click(function2);
 $(#link).click(function(){
    firstFunctionToBeCalled(function (){
       // ok, we're inside the callback - now execute function1 and
 function2
    });

 }); // somehow this needs to be the first one that is called

 function firstFunctionToBeCalled(callback){
     // here some user input is expected so function1 and function2
 must not get called
     callback();

 }

 All this is because I'm asked to put some confirmation boxes (using
 boxy) for a lot of buttons and I really don't want to be going through
 every button.


[jQuery] Re: Ajax

2009-09-14 Thread Steven Yang
hi
this is all i see in the source of your page

!DOCTYPE html html head titleAjax - jQuery Tests/title script src
=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;/script
style

i dont think its complete. Might be something wrong on your serverside
program.
On Tue, Sep 15, 2009 at 9:02 AM, Matt marine.ro...@gmail.com wrote:


 I made a page that would load 2 html pages, had a footer to show both,
 2 links to show indivually, the divs to load them in, and the sticky
 footer css. My js seems valid, but the page is just completely blank.
 URL: http://testingspot.hostcell.net/sandbox/tests/jquery/ajax/ajax.html


[jQuery] Re: Get help with wildCard selector

2009-09-13 Thread Steven Yang
i think what you want is
$('div[id^=abc-]').size()

$('#div[...') means id=div and something else but you dont have anything
with id = div

On Mon, Sep 14, 2009 at 11:30 AM, Conrad Cheng yfch...@gmail.com wrote:

 Dear all,
 I have certain div with below format
 div id=abc-01
 /div
 div id=abc-02
 /div
 div id=abc-03
 /div

 I want to get the no of div who contain abc-* and i have used the wildcard
 , but i seems not work for me...

 I have tired
 $('#div[id^=abc-]').size()

 Can anyone give some hints to me with many thanks!




[jQuery] Re: jquery resistance at work - advice? OR mvc in js, needed?

2009-09-12 Thread Steven Yang
Hi
I am a java guy myself.
from what i know some famous java framework has adopted dojo as their
default support for their client side tech. And the Struts2 used to include
dojo as their native support, now as a plugin i think.

I an understand why your java guy is always mvc this mvc that. Its almost
what we talk about when it comes to design.

I think it really depends on why you need MVC on your javascript side.
If your client side need to be run in different environment. for example,
browser (online, offline with gears), or in AIR with the same code. Then MVC
is probably what you have to consider.
I am not too familiar with dojo, only used it for a while when i wasnt good
at javascript, but hated the complicated API.
I personally really like ExtJS's way of doing things, even though i use
jQuery now.^^

I think the main reason(as far as i can think of) for doing MVC is when you
are in a situation where your client side(javascript) does not know where
your data is coming from and the format will change. ie. JSON, XML, or even
plain text.

here is just my opinion
correct my if i am wrong on anything


On Sun, Sep 13, 2009 at 9:59 AM, mattkime mattk...@gmail.com wrote:


 My new employer produces a web app which relies on Dojo. I haven't
 been impressed with their use of Dojo and am hoping they'll let me
 introduce them to jQuery. There is considerable resistance. The
 project architect is java guy so it frequently seems like we're
 talking two different languages when we discuss js frameworks. I'm all
 DOM this, and cross-browser that and he's all widget this and mvc
 that

 Which has me thinking - have any of you seen a reason to implement a
 MVC layer in your js?

 Its my impression that MVC tries to solve a problem that js doesn't
 particularly have.

 thanks,
 matt

 p.s. sorry if this is a little off topic, but i wanted to get opinions
 from fellow jQuery users.


[jQuery] Re: problem xml with jquery IE 8

2009-09-08 Thread Steven Yang
sorry i may be wrongbut until someone has a real solution
here's something you can try

1. make your dataType --dataType: xml

2. not sure if the problem still exists in IE8, but IE seems to have a
problem determining an incoming data as XML, so make sure your server
returns a header that tells the browser that the content-type is XML.

On Wed, Sep 9, 2009 at 4:45 AM, elisa phorte.elisapere...@gmail.com wrote:


 Hi! I'm learning JQuery, and I have a problem to solve.

 This script is working fine with google and firefox, but IE 8. It does
 nothing in IE... I don't know what I'm doing wrong, or what else I can
 change.

  I'm using a plugin to convert a string of XML to a DOM object with
 jQuery, it's from http://outwestmedia.com/jquery-plugins/xmldom/;.
 And the script should show the description of every word that was
 clicked and have the style palavra-chave(in english it means
 keyword). The description  is written in an XML file. I'll show the
 script (please, remember that I'm a begginer, it may be a ridiculous
 script for you):


 $(document).ready(function(){

 $(document.body).append(div class=descr /div);

$(function(){

$(.palavra_chave).click(function(e){
var palavra = $(this).text();
var x = e.pageX;
var y = e.pageY;
var posX = $(window).width()/2;

$.ajax({
   type:GET,
   url: so_xml.xml,
   dataType: html,
   contentType: application/x-www-form-urlencoded;
 charset=iso-8859-1,
   success: function (xml) {


  $.xmlDOM(xml).find('palavras').each(function(){

var texto =
 $(this).find(palavra).text();

if(xposX)
{
var z = x-400;
var y = y-100;
$(.descr).css({top:y, left:z,
 position:absolute, z-
 index:10, background-color:#a2cffc});
$(.descr).html(table width='200'
 border='0' cellspacing='0'
 cellpadding='0'trtd + texto + /td/tr/table);
$(.descr).fadeIn('fast');
$(.descr).fadeIn(z +', '+ y);
$(.descr).hover('out',
 function(){$(.descr).fadeOut
 ('fast')});
}
else {
var y = y-100;
$(.descr).css({top:y, left:x,
 position:absolute, z-
 index:10 , background-color:#a2cffc});
$(.descr).html(table width='200'
 border='0' cellspacing='0'
 cellpadding='0'trtd + texto + /td/tr/table);
$(.descr).fadeIn('fast');
$(.descr).fadeIn(x +', '+ y);
$(.descr).hover('out',
 function(){$(.descr).fadeOut
 ('fast')});
}
});
}
 });
});
});
 });




[jQuery] Re: About jquery append and automatic deleting

2009-09-06 Thread Steven Yang
yeah append actually moves the element.
you might want call clone() on the existing element then append the new
element created by clone to wherever you want


On Sun, Sep 6, 2009 at 3:40 PM, 月讀 keyoft...@gmail.com wrote:

 My English is not weill.

 https://developer.mozilla.org/En/DOM/Node.appendChild

 If child is a reference to an existing node in the document, appendChildmoves 
 it from its current position to the new position.

 jQuery is actually to invoke the orignal DOM method.


 On Sun, Sep 6, 2009 at 1:41 PM, lovespring iamd...@gmail.com wrote:


 when you append by using an existing content, jquery will delete the
 orignal:

 $(new).append($('#ori'));

 then the orignal $('#ori') in the document will be deleted, is this by
 design?





[jQuery] Re: Extending objects with internal objects

2009-09-06 Thread Steven Yang
look here
http://docs.jquery.com/Utilities/jQuery.extend#deeptargetobject1objectN

http://docs.jquery.com/Utilities/jQuery.extend#deeptargetobject1objectNthe
first argument is the deep copy option.
check it out

On Mon, Sep 7, 2009 at 12:36 PM, roydukkey royduk...@gmail.com wrote:

 Thanks, that worked. But how did you know this, I can't find it
 documented anywhere?

 On Sep 6, 5:16 am, 月讀 keyoft...@gmail.com wrote:
  o = $.extend(true, {}, d, s};
 
  On Sun, Sep 6, 2009 at 7:50 AM, roydukkey royduk...@gmail.com wrote:
 
   Is there a better way to extend object with internal objects?
 
   $.fn.bestShow = function(s) {
  var d = {
  width: 0,
  height: 0,
  order: numeric,
  orderBy: ,
  animation: {
  type: fade,
  delay: 5000,
  speed: 2000,
  overlay: false
  },
  controls:   {
  numeric: 0,
  next: false,
  play: false,
  stop: false,
  prev: false
  }
  };
 
  o = $.extend({},d,s);
 
  if (typeof(s) != 'undefined') {
  if (typeof(s.animation) != 'undefined') o.animation =
   $.extend({},
   d.animation, s.animation);
  if (typeof(s.controls) != 'undefined') o.controls =
   $.extend({},
   d.controls, s.controls);
  }



[jQuery] Re: No Response Using getJSON

2009-09-05 Thread Steven Yang
try 
$.getJSON(http://130.216.208.254:10001/all_data.jsonhttp://130.216.208.254:10001/all_data.json?
callback=getdata,
getdata);

i think you might have confused getJSON with the JSONP result



On Sat, Sep 5, 2009 at 9:50 PM, Tony e.sen...@gmail.com wrote:


 I am using the getJSON command and using firebug for debugging, if I
 go to this server i setup with this url:
 http://url/all_data.json?callback=getdata

 It returns json data warped with getdata({data}). I have validated the
 json part using jsonlint, so from firebug's net tab I get a param
 (callback getdata), header and response, etc. as expected. But if I
 use jquery's getjson, I get param, and header but the response is
 empty and function callback doesn't trigger (no alert).

 I have been pulling my hair out trying to solve this for the last few
 hours (I know that getjson uses OPTIONS instead of GETS and I can see
 that the request is made on the server and the json should be sent as
 normal).

 Here is my code for this section:

 script type=application/javascript
 function getdata(data){
alert(data.name);
 }
 $.getJSON(http://130.216.208.254:10001/all_data.json?
 callback=getdata);
 /script



[jQuery] Re: $.each cannot iterator my array

2009-08-28 Thread Steven Yang
you are doing a very weird thing to an array
I guess jQuery detects that myArray is a reall Array.
Then it iterate over it by using the length attribute. However you didnt
actually put anything into the Array myArray therefore, you dont get
anything.



On Fri, Aug 28, 2009 at 3:49 PM, davidshe...@googlemail.com 
davidshe...@googlemail.com wrote:


 Hi,

 i have an array initialized like
 var myArr = new Array();

 later I use

 myArray['somestring'] = new Array();
 myArray['somestring'].push(mydata);

 to create and new array inside of it, and populate my data by pushing.
 Then I want to use the jQuery.each(...) to iterator over it, like this

 $.each(myArray, function(){
 alert(this);
 });

 But I found the jQuery does not event enter the loop. What's wrong
 with my array?



[jQuery] Re: Superfish menu help!

2009-08-25 Thread Steven Yang
hi
sorry, please correct me if i am wrong or if i over looked at something

i didnt see anything superfish includes or event jquery includes
but instead i see mootools

is the link a demo to your problem?


[jQuery] Re: Jquery + ExtJS 3.0

2009-08-24 Thread Steven Yang
try switching the order of script type=text/javascript
src=...ext-all.js/script
script type=text/javascript src=...ext-jquery-adapter.js/script

to
script type=text/javascript src=...ext-jquery-adapter.js/script
script type=text/javascript src=...ext-all.js/script


[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: can't return value after $.ajax call

2009-08-10 Thread Steven Yang
aside from the fact that checkIfUsername does not have a return
ajax function is not going to waitwhen you finished calling $.ajax your
function has already ended(returned)
then when server responded your returnUsernameBool will be called but thats
already too late for your alert(bValid)

thinking as $.ajax is creating another thread and your callback is run in it
might help (eventhough javascript is single threaded)


[jQuery] Re: can't return value after $.ajax call

2009-08-10 Thread Steven Yang
if thats the case try
function checkIfUsername(o)
{
  var bool;
   $.ajax({
   type: POST,
   url: +CI_ROOT+index.php/admin/check_if_username,
   data: ({username: username.val()}),
   async: false,
   dataType: json,
   success: function(data){
   if(data.bool == true){
   o.addClass('ui-state-error');
   updateTips(Your username must be unique);
   //return false;
   bool = false;
   }
   else{
   //return true;
   bool = true;
   }
   }
   });
  return bool;
}

i am not very familiar with the case that async:false
but from what you described, this should work


[jQuery] Re: can't return value after $.ajax call

2009-08-10 Thread Steven Yang
by using var bool = true;you made bool local to your callback and not to
your checkIfUsername
so checkIfUsername does not have a reference of bool you have to make bool
local to checkIfUsername so you first declare var bool in checkIfUsername,
then allow your callback to assign it a value.


[jQuery] Re: tablesorter, sort values in anchor as numerics

2009-07-27 Thread Steven Yang
personally i do not understand anything this guy says
back to the topic

i personally will put an extra/custom attribute in a like a ref=39

then $(a) and sort on the ref attribute.

If not mistaken, there is a sorting plugin somewhere or even in jQuery core.
Or you should be able to do it easily

On Mon, Jul 27, 2009 at 9:05 PM, mila mshneyder...@gmail.com wrote:


 I am sorry, I did not understand your answer.  Do you have a solution
 to my problem?

 On Jul 26, 3:41 am, 刘永杰 liuyongjie...@gmail.com wrote:
  easyer.
 
  2009/7/25 mila mshneyder...@gmail.com
 
 
 
   I have data that looks like that
 
   a href='myURL/myapp?name=mynameparam1=val'23/a
   a href='myURL/myapp?name=hisnameparam1=val1'9/a
 
   I need it to be sorted numericaly by values between /a.  How do I
   do that?
 
 



[jQuery] Re: jQuery Conference Update

2009-07-21 Thread Steven Yang
man envy you guys who can go
for some who live and earn a living a Taiwan, its so hard/expansive for me
go to.

but still hope you guys have a great weekend

just dunno if anybody can share the experience on youtube or something?


[jQuery] Re: document.ready - how to make sure all js is loaded?

2009-07-13 Thread Steven Yang
ohoh
so even if you do that your myevents.js still doesnt get loaded when
document.ready is run?
thats weird. I have never run in to problem like that.
just wondering is your tag
script type=text/javascript src=myevents.js?
or
script type=text/javascript src=myevents.js/script?

because script is not self closing and not sure if its just your sample so
you omitted as well.


[jQuery] Re: how to detect if user input is a chinese character?

2009-07-12 Thread Steven Yang
hi
are you checking for Chinese specifically? or just non-English?

I remember seeing a solution for non-English somewhere.
Someone told me you can check the first byte or something for Chinese.

not to be mean or anything
But I think its really best if you google it more will faster than sitting
here for answer.
After all this is a jQuery forum


[jQuery] Re: jQuery ajax - can i know if the server is alive ?

2009-07-12 Thread Steven Yang
I dont believe there is a way to tell whether the server is alive or not
before you try to connect to it.
if you  listen on the jQuery Ajax event ajaxError
you will be able to get the HttpStatus from the request object.
I am not sure which code means the server is down, but you will be able to
tell.
I am not sure if this is the best practice, but thats how i do similar
things.


[jQuery] Re: document.ready - how to make sure all js is loaded?

2009-07-12 Thread Steven Yang
i think its best if you do
 script type=text/javascript src=myevents.js/script
script
$(document).ready(function(){
..
.
})
/script

instead of writing your code inside the myevent.js script tag


[jQuery] Re: $.data question

2009-07-07 Thread Steven Yang
hi sorry just wondering if there is anything input on this?by the way i am
currently creating my own object to store the data
but wish to use jQuery's data directly

Thanks a lot


[jQuery] $.data question

2009-06-29 Thread Steven Yang
Hi
Sorry if its already been asked

when i used $.data and pass in ''(empty string), it return me 7. no matter
what i have put for ''.
when i looked at the code i believe 7 was just a generated id from jQuery.
and the reason why it always return the id is because of
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
id;

because '' is false in this case.

is this a bug? or is it an expected behavior?

Thanks


[jQuery] $.data question

2009-06-29 Thread Steven Yang
Hi
Sorry if its already been asked

when i used $.data and pass in ''(empty string), it return me 7. no matter
what i have put for ''.
when i looked at the code i believe 7 was just a generated id from jQuery.
and the reason why it always return the id is because of
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
id;

because '' is false in this case.

is this a bug? or is it an expected behavior?

Thanks


[jQuery] Re: $.data question

2009-06-29 Thread Steven Yang
Hi
sorry for my bad example

i did use something like what you said
but something like $(#something).data('', mystuff);

then $(#something).data('');


[jQuery] Re: $.data question

2009-06-29 Thread Steven Yang
Hihere is my case

please tell me if its reasonable or not or is there a correct way to
approach this

in our application we use empty string as a default value
i was doing a double select function and i want to cache the value from data
get from using getJSON.
I know that I probably should use GET and set $.ajax cache = true.
But for some reason i cannot rely on browser's cache, the maximum cache i
can use is while the page is still loaded. If the page is refreshed i will
need to reload everything as needed and cannot depend on the data in
browser's cache.
so i will have a select with options like
select
option value=--/option
option value=v1value 1/option
option value=v2value 2/option
/select

and upon select i will use the value to refresh the next select.

Thanks


[jQuery] Re: what is wrong with this simple load data codes

2009-06-23 Thread Steven Yang
i am not sure whether
getir.asp?Process=UPSWEIGHT=1PostalCode=90012Country=us
equals to
getir.asp?Process=UPSWEIGHT=1POSTALCODE=90012COUNTRY=us

maybe check that


[jQuery] Re: Question on writing a jQuery plugin

2009-06-22 Thread Steven Yang
Hi
I am not too sure if you can do that but to my understanding all jQuery
plugin returns the selected jQuery object
so if you want to do that you have to add plugin function to jQuery directly
you might want to see how jQuery ui dialog and datepicker to find out how
they do something similar


[jQuery] Re: Converting objects to strings

2009-06-16 Thread Steven Yang
I think what you want i something likevar params = {
   TotalApartmentsServed: $('#TotalApartmentsServed').val(),

 TotalWashroomsPerApartment:$('#TotalWashroomsPerApartment').val(),
   TotalPowerPipeUnits: $('#TotalPowerPipeUnits').val(),
   DrainStackLength: $('#DrainStackLength').val(),
   DrainStackDiameter: $('#DrainStackDiameter').val()
   };

i think you only want to submit the value of the fields back to server
right? not the entire elements


[jQuery] Re: Enable Submit button

2009-06-15 Thread Steven Yang

 maybe try something like this


$(#yesBut, #condBut).click(function(){
   if($(#yesBut).is(:checked)  $(condBut).is(:checked)) {
 $(#SubmitCard).removeAttr(disabled);
  }
  else {
 $(#SubmitCard).attr(disabled, disabled);
  }
})

i am not too sure of my syntax and stuff, but hopefully you get the idea

and hopefully someone come up with a better solution than mine


[jQuery] Re: how to assign date picker for all class date ?

2009-06-11 Thread Steven Yang
$('.datepicker').datepicker()
only applies to the input with class=datepicker when you call it.
so any new added element will not be affected


[jQuery] Re: remove question

2009-06-11 Thread Steven Yang
i guess you just have to move div 2 somewhere else before you remove div 1


[jQuery] Re: json indexing not working for me

2009-06-02 Thread Steven Yang
sorry i am not too familiar with phpput i guess $arr or $_GET is all the
parameters you get from the GET request.
can you simply print out the $arr and $myjson somewhere on server and see?


[jQuery] Re: json indexing not working for me

2009-06-01 Thread Steven Yang
json is the data passed back from the serverdoes the data passed back from
server look like

{
member :
{
name : some name
}
}
?

or are u just trying to access your data?


[jQuery] Re: Pass var to click event

2009-05-26 Thread Steven Yang
the test your calling is the one you defined for the function
try
var test = 'Works!';
$('#action_confirm').click(function(){
alert(test);
});


[jQuery] Re: set the gap of start and end date in datepicker

2009-05-26 Thread Steven Yang
hi here is how i do to set start date cannot be after end date

$(#startId, #endId).datepicker({
beforeShow : function(input) {
return {
'minDate' : (input.id == 'endId' ?
$('#startId').datepicker('getDate') : null),
'maxDate' : (input.id == 'startId' ?
$('#endId').datepicker('getDate') : null)
};
}
})

basically you have to modify the date after you get the date from datepicker

hope it help you get started


[jQuery] Re: Can the click() function be used in an if statement

2009-05-26 Thread Steven Yang
how do you click A and invoke B's onclick?the only way is A is B's child. as
far as i can think
and if thats the case you have event bubbling
you can stop this by calling event.stopPropagation()


[jQuery] Re: validate plugin error: $(#short-form).validate is not a function

2009-05-24 Thread Gallagher Steven
Thanks for your reply.

Does it matter where things are placed on the server relative to each other if 
the paths are correct?

My js file is working fine with jQuery.  Here's the include code, and I've 
verified that the paths are correct, neither of the plug-ins are working.

script type=text/javascript src=/misc/js/lib/jquery.js/script
script type=text/javascript 
src=/misc/js/customForm/cust_select_plugin.js/script
script type=text/javascript 
src=/misc/js/validate/jquery.validate.js/script





From: Jörn Zaefferer joern.zaeffe...@googlemail.com
To: jquery-en@googlegroups.com
Sent: Sunday, May 24, 2009 9:26:24 AM
Subject: [jQuery] Re: validate plugin error: $(#short-form).validate is not  
a function

You most likely screwed up the javscript include of
jquery.validate.js. Make sure the path is right.

Jörn

On Sat, May 23, 2009 at 5:51 PM, stevegmag steveg...@yahoo.com wrote:

 jQuery JavaScript Library v1.3.2
 jQuery validation plug-in 1.5.2

 I think I'm using this plug-in straight from the examples for a simple
 form.  No matter what I have as the last option I get a similar error,
 in the case:

 $(#short-form).validate is not a function
 privacy_policy: Please accept our privacy policy

 This also throws an error:
 jQuery.validator is undefined in additional-methods.js
 jQuery.validator.addMethod(maxWords, function(value, element,
 params) {

 Sorta pulling my hair out at this point as I can't figure out what's
 causing either.

 Form HTML: (if more HTML would help let me know)
 form id=short-form name=short-form action=!-- cut action --
 method=post
label for=name class=firstName/label
input type=text class=text name=name id=name value=Your
 Full Name /
label for=emailEmail Address/label
input type=text class=text name=email id=email
 value=y...@youremail.com /
fieldset
input type=checkbox class=checkbox name=news_updates
 id=news_updates value=yes /label for=news_updates class=float-
 rightYes, email me news and updates/label

input type=checkbox class=checkbox name=privacy_policy
 id=privacy_policy value=yes /label for=privacy_policy
 class=float-rightI have read and understand the a href=#privacy
 policy/a/label
/fieldset
label for=birth_yearYear of Birth/label
select id=birth_year name=birth_year
 option label= value=nullBirth Year/option
 !-- cut remaining options--
/select
button type=submit id=sign-up value=sign-upSign Up/button
 !-- cut hidden fields --
 /form

 Javascript:
 $(document).ready(function() {
$(#short-form).validate({
rules: {
name: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
birth_year: {
required: true
},
privacy_policy: {
required: true
}
},
messages: {
name: {
required: Please enter a username,
minlength: Your username must consist of at 
 least 2 characters
},
email:  Please enter a valid email address,
birth_year:  You must select a Birth Year,
privacy_policy: Please accept our privacy policy
}
});
 });




  

[jQuery] Re: know if one id are hidden

2009-05-22 Thread Steven Yang
one way i can think of on top of my head is
if($(#check_id:hidden).length == 0)
then its hidden


[jQuery] Re: Begginner Problems......

2009-05-21 Thread Steven Yang
Hi
I am not too sure what your doesnt work means.
But for a couple of things
First, I dont think number for id is valid
try make your id=id1 instead of id=1
Second try $().attr(checked, checked) and $().attr(checked, ) or
$().removeAttr(checked)

and see if you get anything


[jQuery] Re: Web dev problem face to face with JAVA J2EE Dev's

2009-05-19 Thread Steven Yang
yes basically instead of a jsp-generated htmla json or xml text should do
the job
and those guys don't even have to worry about how to present the
information. all they need to do is pass the data or tell you that the
handshake was unsuccessful


[jQuery] Re: Web dev problem face to face with JAVA J2EE Dev's

2009-05-19 Thread Steven Yang
well I think you have to decide a working model by between you and your java
guys.As you know and probably what your trying to do, you make almost make
the browser work like client-server model (not that they are not, just not
so clearly i guess).
If you want do all the display and UI logic by javascript, then all you need
is probably the data that you need to display. Then you can just tell the
java guys to serve you data only, maybe except when you load the first page
of course, so you can keep your url consistent.

And just to make sure you know. servlet is main thing that java use for
web applications. so dont be scared to talk about servlet.
But the important thing is what's the data and the format of the data
generated BY THE servlets.

In my project, I have servlets delivering jsp generated HTML and JSON
formated text depending on the situation.
I believe you can do that as well. Just that the java guys may want some
kind of organization within themselves to separate the different kind of
output and thats something you dont need to know.


[jQuery] Re: How to replace hardcode_value in jquery library

2009-05-18 Thread Steven Yang
what exactly do you mean by hardcode_value in jquery library?there isnt
any/much AFAIK.

if you mean the harcode_value in your code
you can simply do
$.get($(contact).val()), function(data){.

correct me if i misunderstood you


[jQuery] Re: Web dev problem face to face with JAVA J2EE Dev's

2009-05-18 Thread Steven Yang
Well the 2 major ways to communicate between server and client are XML and
JSON I guess, besides HTML of course.I believe any hardcore java developer
is familiar with XML. So if you are willing to deal with XML you can ask
them to format their input(for you, or output for them) in decided XML
format.
Or you can ask them to read something about JSON and format to that and send
as plain text to you.


[jQuery] Re: Picking an element from a set

2009-05-14 Thread Steven Yang
when you do $().get() or $()[] you get the actual element back.
so with your case, you can do $($(div.test)[2]).fadeOut()
or $(div.test:eq(2)).fadeOut()


[jQuery] Re: jquery expressions after loading content via ajax

2009-05-12 Thread Steven Yang
correct me if i misunderstood you
so what you mean is that you have some element with class tooltip when the
page load the first time and when you call $(.tooltip).tooltip() things
work.
but when you call ajax and load some more content (containing element with
class tooltip as well) into the page the newly loaded elements do not have
tooltip right?

if this is the case, this is because when you call $.tooltip it only applies
to the element thats on the page already. if you add new content to the page
you have to apply it to these new elements manually


[jQuery] Re: jquery expressions after loading content via ajax

2009-05-12 Thread Steven Yang
yes thats rightor maybe you can run this just once after all you content has
been loaded depend on your situation
because i am not sure if there will be any issues if you run it on the same
element twice


[jQuery] Re: when use addclass and toggleclass

2009-05-10 Thread Steven Yang
when you do addClass it literally only add the class to the element
when you do toggleClass it checks whether the element has the class or not,
if it does then it will remove the class if it doesnt then it will add
the class


[jQuery] Re: json syntax question (ticket vs unticked names)

2009-05-08 Thread Steven Yang
seriously i am not sure
but sometimes i just hate to see something like
var data = {.something};

var config = {
  data : data
};

so when this happens I do
var config = {
  'data' : data
};
just to be clear


[jQuery] Re: NEW jQuery Cheat Sheet for 1.3.2

2009-05-07 Thread Steven Yang
Ha thanks a lot Matt
This is useful. And reminded me back in the days of taking Computer Science
classes when you can take cheat sheet into the exam.

By the way just that your Excel sheet name is still 1.1.3


[jQuery] Re: Resetting the reset button

2009-05-06 Thread Steven Yang
i dont think you can do thatyou probably have to cache your state yourself
i think reset uses the defaultValue attribute of the input and i think the
attribute is readonly.

correct me if i am wrong


[jQuery] Re: jqModal +r14 updated

2009-04-30 Thread Steven Garcia

I cant seem to get jQuery's live function working with this at all.

I tried all variations possible, including dmitri's suggestion

The modal does indeed pop up, but instead of loading the ajax content,
I get redirected to that URL.

Anyone else run into this problem?


[jQuery] Re: Help About Using JQuery With Struts 2

2009-04-29 Thread Steven Yang
hi
this might just be your typo but isnt url: /AddNewClient suppose to
be url: /AddNewClient.do or .action?

first of all, since your using ajax and it shouldnt have anything to do with
form, so just to be on the save side i would change your button from
type=submit to type=button since you dont really want to submit the form
after all.

one thing i noticed is that the data attribute. isnt it suppose to be a
javascript Object? and not a string?
you can simply do
var data = {'loginClient' : loginClient,
'passwordClientError' : passwordClientError,'passwordClient2'
:passwordClient2
}

 $.ajax({
   type: POST,
   url: AddNewClient.do,
   data: data,
   success: function() {
  $('#Great').html('Great It\'s Done');
   }
 });

 //   alert (dataString);
   return false;

  });
 });

try these changes and see if you get anything


[jQuery] Re: Help About Using JQuery With Struts 2

2009-04-29 Thread Steven Yang
one more thing if you want to ajax submit a form you might want to take a
look at a great plugin
http://malsup.com/jquery/form/


[jQuery] Re: How to get file name

2009-04-28 Thread Steven Yang
i dont think there is actually a jQuery way.i think your best bet is
regular expression
but sorry i am not good at regular expression myself
but you can look at it and find your solution


[jQuery] Re: Help About Using JQuery With Struts 2

2009-04-26 Thread Steven Yang
are you getting any error?or what are u getting at the server side?
can you explain a bit more?


[jQuery] Re: Check value when adding to array

2009-04-13 Thread Steven Yang
try remove the single quotes

if ($(input[name*=delete_linkid],this)) {
  alert('it does!');


[jQuery] Re: code review for short snippet

2009-04-04 Thread Steven Black

 p.s. I don't know what happen with my repeated original post. I must
 have gotten overzealous with the submit key. :p

Note that, clicking More options, you can delete your posts.

**--**  Steve

On Apr 4, 5:12 pm, John H realistinden...@gmail.com wrote:
 Ricardo, this is equally instructive. Thanks to you as well.

 John

 p.s. I don't know what happen with my repeated original post. I must
 have gotten overzealous with the submit key. :p


[jQuery] Re: Work on one specific node and not on the window.document

2009-03-31 Thread Steven Yang
do you have a special reason to find an element by id in a specific node?isn't
id suppose to be unique in the whole document?


[jQuery] Re: can someone take a look please...

2009-03-31 Thread Steven Yang
do you have anything in the html also with name=partnum?because in IE the
getElementById actually get the name first
if you use jQuery simply try $(#partnum).val(result)


[jQuery] Re: Get element's html and the element

2009-03-30 Thread Steven Yang
well html() just gets the innerHTMLso your out of luck there
there is actually a plugin for getting the actually container html
I remember coming across it on the jquery plugin pages
you can try finding it there

All i can say is its doesnt seem hard, but also not as easy as you think
^^


[jQuery] Re: Get element's html and the element

2009-03-30 Thread Steven Yang
ha thanks mkmanningthats sure something never came across in my mind
good idea


[jQuery] Re: looping through json

2009-03-26 Thread Steven Yang
I think the problem is you have the department 3 times in the same hash
object,so the last one overrides everything.
you should change departments to an array and loop through it


 
  { departments: {
 department: {ID: 1, Name: Physics},
 department: {ID: 2, Name: Chemistry},
 department: {ID: 3, Name: Biology}
  }}
 
  i tried
 
  $.each(json.departments.department, function(i, n) {
alert(i +   + n);
  });
 



[jQuery] Re: data is posted only once

2009-03-24 Thread Steven Yang
how about try setting cache:false?


[jQuery] Re: Multiple data, JSON and AJAX

2009-03-24 Thread Steven Yang
I think you have to use .each and loop through all the divs and gather the
information and then send the information once at the end with $.ajaxor
otherwise you might end up with one $.ajax call for each div


[jQuery] Re: referring to an array with a specific name

2009-03-24 Thread Steven Yang
i think what macsig means is
his arrays are like

var a =[array a]
var b = [array b]

if thats the case
you might want to do

var arrays = {
 'a' : [array a],
 'b' : [array b]
}

then when select changes and you get the value
you can get your array with
var myArray = arrays[val];


[jQuery] Re: is it possible to do this (ignore clicks)

2009-03-20 Thread Steven Yang
i believe you can simply do e.stopPropagation()because you get event
bubbling for the events inside the div
all the events bind to element inside your div should use
e.stopPropagation()

please correct me if i am wrong


[jQuery] Re: Ajax call problem with Firefox

2009-03-19 Thread Steven Yang
I think its a browser behaviorif you use get, browser's default behavior
is usually cache it. Unless you set no cache in browser setting.
So I always use post and to be on the save side use cache : false as well

correct me if i am wrong


[jQuery] Re: Problems whith the variables for a click function

2009-03-19 Thread Steven Yang
did you get an error if no value was given?
because it seems like your parsing an empty string into an int

and it looks like your value after the first calculation will always be the
original value.
because you never set pris except when the page loaded


[jQuery] Re: $.getJSON isn't working while getting the JSON data from hidden field

2009-03-18 Thread Steven Yang
yes $.getJSON does do eval internally
so what your trying to accomplish is, trying to eval a string into
javascript object but u dont want to write eval() everywhere right?

or i misunderstood your question in anyway?


[jQuery] Re: $.getJSON isn't working while getting the JSON data from hidden field

2009-03-17 Thread Steven Yang
Sorry if i am mistaken in anywaybut $.getJSON is suppose to be for getting
JSON data from remote server or simply server, but not for you to eval a
String into javascript object. And from the source of jQuery I believe it
will simply to eval('('+json+')') anyway.
And if you want to do it that way, why not just save your string in a
javascript variable?
or if its generated serverside, then you dont even have to eval it.


[jQuery] Re: New Plugin Orange Tool Kit

2009-03-16 Thread Steven Yang
Hi please correct me if i have been mislead.
Sorry I cant give you much advise here.

I believe your doing a Template plugin.
I have actually been looking for one for a long time for jQuery, but cant
find one exactly suite my use. I am actually looking for the Template like
Ext.
Your plugin looks nice, and syntax is something i am looking for. Just that
do you support JSON array? Basically looping.
If you do, then it would be very close to something I am looking for.

Thanks


[jQuery] Re: jQuery.each need extra check for object

2009-02-25 Thread Steven Black

Do you have a test case for this one?

I have a hard-time imagining the scenario you describe when jQuery is
invoked properly.

I'm guessing that, in this particular situation, the object of
discourse isn't actually a jWuery object.  In other words, try

  $(myVar).each(...)
instead of
   myvar.each(...)

I'm guessing s.

**--**  Steve

On Feb 25, 8:03 pm, pbcomm pbc...@gmail.com wrote:
 If the object passed into jQuery.each is null or undefined you get an
 error at object.length on the first line. Maybe there should be a
 check if (object == null) return object;? What do we think?


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

2009-02-24 Thread Steven Yang
according to your case
use$(.box)
or
$(div .box)
since all elements with class box will have background image


[jQuery] Re: preventing redirection when opening modal dialog box

2009-02-23 Thread Steven Yang
have you tried changing the type of btnAddSession from submit to button?


[jQuery] cross frame menu

2009-02-15 Thread Steven Yang
Hi
I know this is not directly related to jQuery, but I really need some help.
I have found many menu plugin for jQuery. However, none are supporting cross
frame.
I am thinking of doing one myself, but I dont really know the concept or the
main idea of how to do it.
Can anyone point me to the right direction? or is there a good tutorial
somewhere?

Thanks


[jQuery] Hiding Dialog 'x' button

2009-02-11 Thread Steven Yang
Hi
I want to hide the 'x' button on the dialog dynamically.
Is there a good way to do it? or is there a setting? i couldnt find one.
All i can think of is doing something like
$(.ui-dialog-titlebar-close).css(display, none);
However I dont think this is a good way. And if i have more than one dialog
on the page then all 'x' buttons will disappear.

Thanks


  1   2   >