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  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:
>
>
>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>  />
> Sandbox
> 
> body { background-color: #000; font: 16px Helvetica, Arial;
> color: #fff; }
> 
> http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"</a>;>
> 
> function setsecond(){
> mySelect.options.item(1).selected = true;  // IE only code
>
> }
> $(document).ready(function(){
> $("#mySelect").change(function(){
> alert($(this).find("option:selected").val());
> });
> });
> 
> 
> 
>
> 
> Value 1
> Value 2
> 
> 
> 
>
>
>
> 2010/1/19 David Statler 
>
> 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.
>>
>
>>
>> >   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
>> 
>> > />
>> Sandbox
>> 
>> body { background-color: #000; font: 16px Helvetica, Arial;
>> color: #fff; }
>> 
>> http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"</a>;>
>> 
>> $(document).ready(function(){
>>     $("#mySelect").change(function(){
>> alert($(this).find("option:selected").val());
>> });
>> });
>> 
>> 
>> 
>> 
>> Value 1
>> Value 2
>> 
>> 
>> 
>>
>>
>>
>>
>> On Tue, Jan 19, 2010 at 6:06 AM, pambuk  wrote:
>>
>>> Same here, would love to hear an answer.
>>>
>>> On Jan 19, 11:00 am, Steven Yang  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
>>>
>>
>>
>


[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/ 

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 wrote:

> > 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  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  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();
> > /*
> > $('').html
> > (''+title+'').appendTo('#page-wrap');
> > $(this).find('desc').each(function(){
> > var brief = $(this).find('brief').text();
> > var long = $(this).find('long').text();
> > $('').html(brief).appendTo
> > ('#link_'+id);
> > $('').html(long).appendTo
> > ('#link_'+id);
> > });
> > */
> > alert(city)
> > //});
> > }
> > });
> >
> > });
> >
> > The XML file looks like this
> > 
> > 
> > 74.125.45.100
> > OK
> > US
> > United States
> > 06
> > California
> > Mountain View
> > 94043
> > 37.4192
> > -122.057
> > -8
> > -8
> > -7
> > 
> >
> > But I can't get it to pull the data out.
>


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

2009-09-20 Thread Steven Yang
tryhttp://www.google.com";>google

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

>  Hi,
>
> Why this code not working?
>
> google
>
> url www.google.com open in same windows.
>
>
> Thank´s
>


[jQuery] Re: ajax xml question

2009-09-17 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  wrote:

>
> But I got one more question
> http://www.google.com/ig/api?hl=zh-tw&weather=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"  wrote:
> > terrific!!! thanks a lot
> >
> > On 9月17日, 下午5時57分, lanxiazhi  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  problem.
of course i maybe wrong

On Thu, Sep 17, 2009 at 7:09 PM, ldexterldesign
wrote:

>
> 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: 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 
and the id is the same as your 



On Tue, Sep 15, 2009 at 7:05 PM, Matthew Rolph wrote:

> 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  wrote:
>
>> hi
>> this is all i see in the source of your page
>>
>> Ajax - jQuery Tests > src="<a  rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"">http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"</a>;>
>>  

[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  wrote:

>
> Thanks for the response..I tried ..both no luck..
>
> On Sep 15, 3:43 pm, Steven Yang  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  wrote:
> >
> > > Hi,
> >
> > > I'm getting Javascript error "object expected"on PageLoad at the
> > > following line:
> >
> > > $(document).ready(function()
> >
> > > I found that  alert(typeof $); is returing undefined.
> >
> > > Below is the code snippet:
> >
> > >  
> > > > > language ="javascript">
> > >
> > >
> > >
> > > > > language ="javascript">
> >
> > > 

[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  wrote:

>
> Hi,
>
> I'm getting Javascript error "object expected"on PageLoad at the
> following line:
>
> $(document).ready(function()
>
> I found that  alert(typeof $); is returing undefined.
>
> Below is the code snippet:
>
>  
> language ="javascript">
>
>
>
> language ="javascript">
>
> 

[jQuery] Re: Ajax

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

   Ajax - jQuery Tests http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js";>

[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  wrote:

> Dear all,
> I have certain div with below format
> 
> 
> 
> 
> 
> 
>
> 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  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  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(" ");
>
>$(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(x>posX)
>{
>var z = x-400;
>var y = y-100;
>$(".descr").css({"top":y, "left":z,
> "position":"absolute", "z-
> index":"10", "background-color":"#a2cffc"});
>$(".descr").html(" border='0' cellspacing='0'
> cellpadding='0'>" + texto + "");
>$(".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(" border='0' cellspacing='0'
> cellpadding='0'>" + texto + "");
>$(".descr").fadeIn('fast');
>$(".descr").fadeIn(x +', '+ y);
>$(".descr").hover('out',
> function(){$(".descr").fadeOut
> ('fast')});
>}
>});
>}
> });
>});
>});
> });
>
>


[jQuery] Re: Extending objects with internal objects

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

the
first argument is the deep copy option.
check it out

On Mon, Sep 7, 2009 at 12:36 PM, roydukkey  wrote:

> Thanks, that worked. But how did you know this, I can't find it
> documented anywhere?
>
> On Sep 6, 5:16 am, 月讀  wrote:
> > o = $.extend(true, {}, d, s};
> >
> > On Sun, Sep 6, 2009 at 7:50 AM, roydukkey  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: 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, 月讀  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  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: No Response Using getJSON

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

i think you might have confused getJSON with the JSONP result



On Sat, Sep 5, 2009 at 9:50 PM, Tony  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:
>
> 
> function getdata(data){
>alert(data.name);
> }
> $.getJSON("http://130.216.208.254:10001/all_data.json?
> callback=getdata");
> 
>


[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-23 Thread Steven Yang
try switching the order of 


to




[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: 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
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: 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  like 

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  wrote:

>
> I am sorry, I did not understand your answer.  Do you have a solution
> to my problem?
>
> On Jul 26, 3:41 am, 刘永杰  wrote:
> > easyer.
> >
> > 2009/7/25 mila 
> >
> >
> >
> > > I have data that looks like that
> >
> > > 23
> > > 9
> >
> > > I need it to be sorted numericaly by values between >.  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-12 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
?
or