[jQuery] Re: Expectetd identifier, string on number

2010-01-06 Thread MorningZ
"Wonder why that is? "

https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words

it's just that browsers other than IE handle it (much) more
gracefully  :-)

Also just a quick tip on your code in general... if you know the ID of
something, then use *just* the ID for the selector... so in your code

 jQuery("select#article_is_in_1");

should be

 jQuery("#article_is_in_1")

the first is slower because it is like "find all select objects on the
page, then find the one with this ID"

the second is faster because it'll use document.getElementById, which
is very fast   :-)

if you want to read more: http://www.componenthouse.com/article-19


All the multiple .hide() calls could be cleaned up too... even if it's
just a loop if it has to be 2 through 14

for (var j=2; j <= 14) {
jQuery('#article' + j).hide();
}




On Jan 6, 6:47 am, youradds  wrote:
> Ah never mind - found it:
>
> do: "wiki_ajax",
>
> For some reason it doesn't like do: , so I renamed to wiki_do, and its
> fine now
>
> Wonder why that is?
>
> TIA
>
> Andy
>
> On Jan 6, 11:46 am, youradds  wrote:
>
> > Hi,
>
> > Got a bit of a weird issue in IE 8 with this code:
>
> >                  jQuery.getJSON("/v.f", {  do: "wiki_ajax", id:  jQuery
> > (this).val(), field: "1" }, function(j){
>
> > The whole function is:
>
> >  jQuery.noConflict();
>
> >  jQuery(function(){
> >          jQuery("select#article_is_in_1").change(function(){
> >                  jQuery.getJSON("/v.f", {  do: "wiki_ajax", id:  jQuery
> > (this).val(), field: "1" }, function(j){
>
> >                                                  clear_further_up(2);
>
> >                                  jQuery('#article2').hide();
> >                          jQuery('#article3').hide();
> >                          jQuery('#article4').hide();
> >                          jQuery('#article5').hide();
> >                          jQuery('#article6').hide();
> >                          jQuery('#article7').hide();
> >                          jQuery('#article8').hide();
> >                          jQuery('#article9').hide();
> >                          jQuery('#article10').hide();
> >                          jQuery('#article11').hide();
> >                          jQuery('#article12').hide();
> >                          jQuery('#article13').hide();
> >                          jQuery('#article14').hide(); ;
>
> >                          var options = '';
> >                          for (var i = 0; i  >                                  options += '' + j[i].optionDisplay + '';
> >                          }
> >                          jQuery("#article_is_in_2").html(options);
> >                          jQuery('#article_is_in_2 option:first').attr
> > ('selected', 'selected');
>
> >                          if (j.length > 1) {
> >                                jQuery('#article2').show();
> >                          }
>
> >                  })
> >          });
>
> > });
>
> > Can anyone suggest what is wrong with it? Works perfectly fine in FF
> > and Chrome :/
>
> > TIA
>
> > Andy


[jQuery] Re: Expectetd identifier, string on number

2010-01-06 Thread youradds
Ah never mind - found it:

do: "wiki_ajax",

For some reason it doesn't like do: , so I renamed to wiki_do, and its
fine now

Wonder why that is?

TIA

Andy


On Jan 6, 11:46 am, youradds  wrote:
> Hi,
>
> Got a bit of a weird issue in IE 8 with this code:
>
>                  jQuery.getJSON("/v.f", {  do: "wiki_ajax", id:  jQuery
> (this).val(), field: "1" }, function(j){
>
> The whole function is:
>
>  jQuery.noConflict();
>
>  jQuery(function(){
>          jQuery("select#article_is_in_1").change(function(){
>                  jQuery.getJSON("/v.f", {  do: "wiki_ajax", id:  jQuery
> (this).val(), field: "1" }, function(j){
>
>                                                  clear_further_up(2);
>
>                                  jQuery('#article2').hide();
>                          jQuery('#article3').hide();
>                          jQuery('#article4').hide();
>                          jQuery('#article5').hide();
>                          jQuery('#article6').hide();
>                          jQuery('#article7').hide();
>                          jQuery('#article8').hide();
>                          jQuery('#article9').hide();
>                          jQuery('#article10').hide();
>                          jQuery('#article11').hide();
>                          jQuery('#article12').hide();
>                          jQuery('#article13').hide();
>                          jQuery('#article14').hide(); ;
>
>                          var options = '';
>                          for (var i = 0; i                                   options += '' + j[i].optionDisplay + '';
>                          }
>                          jQuery("#article_is_in_2").html(options);
>                          jQuery('#article_is_in_2 option:first').attr
> ('selected', 'selected');
>
>                          if (j.length > 1) {
>                                jQuery('#article2').show();
>                          }
>
>                  })
>          });
>
> });
>
> Can anyone suggest what is wrong with it? Works perfectly fine in FF
> and Chrome :/
>
> TIA
>
> Andy