[jQuery] Re: does JQuery have browser bookmarklet development support??

2009-12-02 Thread George Adamson

I'm not aware of any explicit bookmarklet support but if you need to
get jQuery onto the page then at least it has a nice light file size.
A few things to note:
IE limits the length of your bookmarklet to 250 characters or so.
To keep bookmarklets small it is common to have them simply load a
remote script (from your site) that will actually do the fancy stuff.
If your script needs jQuery then I'd suggest that you load it either
in your bookmarklet or in your script. The google-hosted jquery can be
handy for this.
Maybe worth checking whether there's a compatible version of jQuery
already loaded and use that, before fetching another.
If you load jQuery yourself then you should use it's handy noConflict
option to prevent issues with other libraries etc already on the page.

Hope this helps,
George


On Dec 2, 6:03 am, greghauptmann greg.hauptm...@gmail.com wrote:
 Hi

 I want to development some browser bookmarklets (e.g. for firefox, IE,
 safari) but I'm not sure where to start.  As an example of what I'm
 talking about see:

     *http://www.evernote.com/about/download/web_clipper.php
     *http://readitlaterlist.com/bookmarklets/

 I'm after a way to allow a user pass a browser link (e.g. the page
 they are on) through to my web application  see the bookmarklet
 approach a easier/more basic way to achieve this.  They would have to
 type in their username/password the first time they use it for the
 their authentication to the backend.

 QUESTION:  How does one develop these bookmarklets?  Does JQuery have
 support or supply a template for this?  Or just any other pointers on
 how people do this?

 Thanks


[jQuery] new autosuggestion plug-in. need comments/feedback

2009-10-16 Thread George

I have developed the autosuggestion plug-in.
Looks pretty cool (for me). I actually made is like it's done on
Facebook. (code is 100% mine).

Please take a look and leave me comments/feedback.
Only list of names are working as autosuggestion. Other fields on the
form are just for example.
Also you can have more that one name in the input box.

http://www.tersaakov.com/default.htm


[jQuery] Re: new autosuggestion plug-in. need comments/feedback

2009-10-16 Thread George

Well, it does not support AJAX yet. the list comes from Javascript
array already in the page.
So responsiveness probably has something to do with it.

I just like the way how it looks. I would actually call it tokenizer
and not the autosuggestion.


George.

On Oct 16, 2:53 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 Very responsive, George!
 I'll definitely take a look at this.  I have been wanting to implement
 autocomplete, but just haven't gotten around to it.

 Thanks for sharing!

 Rick



 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of George
 Sent: Friday, October 16, 2009 11:11 AM
 To: jQuery (English)
 Subject: [jQuery] new autosuggestion plug-in. need comments/feedback

 I have developed the autosuggestion plug-in.
 Looks pretty cool (for me). I actually made is like it's done on
 Facebook. (code is 100% mine).

 Please take a look and leave me comments/feedback.
 Only list of names are working as autosuggestion. Other fields on the
 form are just for example.
 Also you can have more that one name in the input box.

 http://www.tersaakov.com/default.htm- Hide quoted text -

 - Show quoted text -


[jQuery] Re: new autosuggestion plug-in. need comments/feedback

2009-10-16 Thread George

It's fairly easy to add. I will do that later this week.
I just wanted to iron out all visual/appearance bugs.

So you can check this link next week.

George.


On Oct 16, 3:23 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 Thanks for letting me know.  I would definitely need ajax support.

 Rick



 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of George
 Sent: Friday, October 16, 2009 3:09 PM
 To: jQuery (English)
 Subject: [jQuery] Re: new autosuggestion plug-in. need comments/feedback

 Well, it does not support AJAX yet. the list comes from Javascript
 array already in the page.
 So responsiveness probably has something to do with it.

 I just like the way how it looks. I would actually call it tokenizer
 and not the autosuggestion.

 George.

 On Oct 16, 2:53 pm, Rick Faircloth r...@whitestonemedia.com wrote:
  Very responsive, George!
  I'll definitely take a look at this.  I have been wanting to implement
  autocomplete, but just haven't gotten around to it.

  Thanks for sharing!

  Rick

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

  Behalf Of George
  Sent: Friday, October 16, 2009 11:11 AM
  To: jQuery (English)
  Subject: [jQuery] new autosuggestion plug-in. need comments/feedback

  I have developed the autosuggestion plug-in.
  Looks pretty cool (for me). I actually made is like it's done on
  Facebook. (code is 100% mine).

  Please take a look and leave me comments/feedback.
  Only list of names are working as autosuggestion. Other fields on the
  form are just for example.
  Also you can have more that one name in the input box.

 http://www.tersaakov.com/default.htm-Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -


[jQuery] Re: jQuery and Ajax conflicting only on macintosh?

2009-10-16 Thread George

Looks like you have an extra  there
see this line: UL id=listB class=connectedSortable 


Might be a problem

On Oct 16, 10:10 am, wogahnct cheryl.jo...@yale.edu wrote:
 I have a very simple script that fails on macintosh only (works on PC
 browsers) when I include the ajax.js file.  I am not even using it
 (not in my simple script anyway, shown below).  When I include that
 file, the drag and drop no longer works on a mac.

 Any help is greatly appreciated

 You can see my two examples here:

 WORKS:  http://cmi2.yale.edu/test/cjohns/working_example.html
 DOES NOT WORK ON MAC:  
 http://cmi2.yale.edu/test/cjohns/nonworking_example.html

 The code is as follows:
 HTML
 BODY

 !-- THIS NEXT LINE IS THE ONE THAT STOPS THE SCRIPT FROM WORKING ON
 MACINTOSH --
 !-- script type=text/javascript src=scripts/ajax.js
 charset=utf-8/script  --

 script type=text/javascript src=scripts/jquery-1.3.2.min.js/
 script
 script type=text/javascript src=scripts/jquery-
 ui-1.7.2.custom.min.js/script

 UL id=listA class=connectedSortable
         LI id=Aitem1A - Item One/LI
         LI id=Aitem2A - Item Two/LI
         LI id=Aitem3A - Item Three/LI
 /UL

 UL id=listB class=connectedSortable 
         LI id=Bitem1AB - Item One/LI
         LI id=Bitem2AB - Item Two/LI
         LI id=Bitem3AB - Item Three/LI
 /UL

 script type=text/javascript charset=utf-8

         $(#listA).sortable({
                 connectWith: ['.connectedSortable']
     });
         $(#listB).sortable({
                 connectWith: ['.connectedSortable']
     });

 /script
 /BODY
 /HTML

 Cheryl Johns
 Yale University


[jQuery] Re: $(document).ready firing before Google Maps scripts are fully loaded

2009-10-16 Thread George V. Reilly

Over in http://groups.google.com/group/google-maps-api/, I got a
suggestion that seems to work consistently: use Google's Ajax loader
to load the Maps API code asynchronously.

script type=text/javascript src=http://www.google.com/jsapi?
key=MY_API_KEY/script
script type=text/javascript
google.load('maps', 2.x, {other_params:sensor=false});
google.setOnLoadCallback(function() { /* My initialization
code */ });
/script

/George


[jQuery] $(document).ready firing before Google Maps scripts are fully loaded

2009-10-15 Thread George V. Reilly

About 1 time in 10, I get an error during my $(document).ready
callback because Google Maps' loader hasn't pulled in all of its
JavaScript dependencies yet.

Using Web Developer  View Source  View Generated Source, here's what
the head of my document looks like when I get such an error.

 head
script src=http://maps.google.com/maps?
file=apiamp;v=3amp;sensor=falseamp;key=MY_API_KEY type=text/
javascript/script
+   script src=http://maps.gstatic.com/intl/en_us/mapfiles/176c/
maps2.api/main.js type=text/javascript/script
script src=scripts/jquery.js type=text/javascript/script
script src=scripts/jquery.jmap.js type=text/javascript/
script
script src=scripts/initialize.js type=text/javascript/
script
 /head

The line starting with + was injected by Google Maps with
document.write. The call to $(document).ready is in initialize.js

  jQuery(document).ready(function($){
jQuery('#map1').jmap('init', {'mapCenter':[37.5, -95.7],
'mapZoom': 4}); // CONUS
  });

#map1 references an empty div to hold the map. I got jquery.jmap.js
from git://github.com/digitalspaghetti/jmaps.

The error is G_NORMAL_MAP is not defined at line 104 of
jquery.jmap.js, but I think jquery.jmap.js is an innocent victim here.

And here's what the head looks like when everything's loaded before my
$(document).ready callback fires:

 head
script src=http://maps.google.com/maps?
file=apiamp;v=3amp;sensor=falseamp;key=MY_API_KEY type=text/
javascript/script
+   script src=http://maps.gstatic.com/intl/en_us/mapfiles/176c/
maps2.api/main.js type=text/javascript/script
+   style type=text/css@media print{.gmnoprint{display:none}}
@media screen{.gmnoscreen{display:none}}/style
+   script src=http://maps.gstatic.com/intl/en_us/mapfiles/176c/
maps2.api/mod_jslinker.js charset=UTF-8 type=text/javascript/
script
script src=scripts/jquery.js type=text/javascript/script
script src=scripts/jquery.jmap.js type=text/javascript/
script
script src=scripts/initialize.js type=text/javascript/
script

+   script src=http://maps.gstatic.com/cat_js/intl/en_us/mapfiles/
176c/maps2.api/%7Bmod_drag,mod_ctrapi%7D.js charset=UTF-8
type=text/javascript/script
+   script src=http://maps.gstatic.com/intl/en_us/mapfiles/176c/
maps2.api/mod_apiiw.js charset=UTF-8 type=text/javascript/
script
+   script src=http://maps.gstatic.com/intl/en_us/mapfiles/176c/
maps2.api/mod_exdom.js charset=UTF-8 type=text/javascript/
script
 /head

The Net tab in Firebug shows that the extra GMaps scripts have not
been loaded in the failure case.

Any suggestions? Does script injection with document.write play well
with $(document).ready?

This is driving me nuts. Any help appreciated.

/George V. Reilly
Seattle, WA




[jQuery] Re: $(document).ready firing before Google Maps scripts are fully loaded

2009-10-15 Thread George V. Reilly

On Oct 15, 6:49 pm, Dave Methvin dave.meth...@gmail.com wrote:
 So all those extra scripts are injected into the head with
 document.write? If so they should have definitely been there before
 any script below them executed. Have you found the place where Google
 Maps is actually doing the document writes for the other scripts? I am
 wondering whether it might be adding at least some of the scripts
 asynchronously by injecting script tags to the head.

The first injected script (main.js) is definitely injected with
document.write. I haven't looked to see how the other one's are
injected, but given that they appear at the end of head after the
explicit script blocks, it suggests that there might be some
appendChild games going on.

/George


[jQuery] ANNOUNCE: jQuery plugin to measure image dimensions

2009-09-26 Thread George Adamson

Here's a little plugin to measure the original width and height of an
image.

http://blog.softwareunity.com/2009/09/measure-raw-image-dimensions-using.html

It has to pass the measurements to a callback so you use it like this:

  $(IMG).imgSize(function(size){
alert(size.width + x + size.height + px  + size.fileSize + 
bytes);
  });

If anyone can think of a way to make it work without using a callback
then let me know!

George


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

2009-09-11 Thread George L Smyth
http://groups.google.com/group/jquery-en/browse_thread/thread/92cd7620c1fde78


[jQuery] [treeview] Problem with reloading ajax tree

2009-08-15 Thread George K
Hi,
I've faced with the problem with reloading ajax tree. I'm reloading it
calling treeview() method with all initializaating params, but after that
all expandable nodes does not expand.
You can reproduce this case with firebug on async tree demo page
http://jquery.bassistance.de/treeview/demo/async.html
run the following code in console:
$(#black).empty().treeview({
  url: source.php
  })
when the tree is loaded 3. After Lunch (120+ min) node does not expand.
Is it  bug or i just didn't understood how to reload the tree?
thanks,
George


[jQuery] [treeview] How to refresh the ajax-builed tree?

2009-08-13 Thread George K

Hi.
I'm using treeview with ajax, but when I need to refresh it, it does
not open closed branches. As an example. Open the demopage with
firebud enabled:
http://jquery.bassistance.de/treeview/demo/async.html

ok. Now I want to refresh it, so I'm writing this code into firebug
console:
$(#black).empty().treeview({
   url: source.php
})

but after that I can't open closed branches, however they're loaded
and rendered, but stay invisible (display:none).

Am I doing something wrong? I couldn't find any hint in the
documentation. When I kill the ul#black and create it again it works
fine, but this solution looks like a voodoo :) :

var black = $(#black);
var blackNew = $(ul).insertAfter(black);
black.remove();
blackNew.attr(id, black);
blackNew.treeview({
   url: source.php
});

Is there any way to fix it and it would be great to mention it in the
documentation.

thanks,
George


[jQuery] What's the best way to replace text in a node?

2009-05-18 Thread George

I'm guessing this should be a simple one for the jQuery stalwarts
here.  I've recently moved over from Protoype and was used to using
the update() function to replace text within a node - something like
this:

PROTOTYPE
p id='dText'text to be replaced/p
$('dText').update('New text string')


JQUERY
p id='dText'text to be replaced/p
$('#dText').remove().append('New text string')

Now it appears to me that in jQuery, there isn't an out of the box
function to replace the contents of a node without also replacing the
node too, hence the reason I am chaining remove() and append().  Is
there a better way to achieve this?

Many thanks

George


[jQuery] Re: What's the best way to replace text in a node?

2009-05-18 Thread George

Sorry, folks, I'm not using remove(), I'm using empty() - like this:

JQUERY
p id='dText'text to be replaced/p
$('#dText').empty().append('New text string')



On May 18, 12:02 pm, George george.bea...@googlemail.com wrote:
 I'm guessing this should be a simple one for the jQuery stalwarts
 here.  I've recently moved over from Protoype and was used to using
 the update() function to replace text within a node - something like
 this:

 PROTOTYPE
 p id='dText'text to be replaced/p
 $('dText').update('New text string')

 JQUERY
 p id='dText'text to be replaced/p
 $('#dText').remove().append('New text string')

 Now it appears to me that in jQuery, there isn't an out of the box
 function to replace the contents of a node without also replacing the
 node too, hence the reason I am chaining remove() and append().  Is
 there a better way to achieve this?

 Many thanks

 George


[jQuery] Re: What's the best way to replace text in a node?

2009-05-18 Thread George

That's what I was after - knew jQuery wouldn't disappoint!

Many thanks

George

On May 18, 1:08 pm, Michael Price m...@edwardrobertson.co.uk
wrote:
 You can use either:

 $(selector).text(New text);
 Or
 $(selector).html(New text);

 Both also work as getters if you don't provide an argument:
 theText = $(selector).text();
 theHTML = $(selector).html();

 Is this what you were after?

 Regards,
 Michael Price

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of George
 Sent: 18 May 2009 12:09
 To: jQuery (English)
 Subject: [jQuery] Re: What's the best way to replace text in a node?

 Sorry, folks, I'm not using remove(), I'm using empty() - like this:

 JQUERY
 p id='dText'text to be replaced/p
 $('#dText').empty().append('New text string')

 On May 18, 12:02 pm, George george.bea...@googlemail.com wrote:
  I'm guessing this should be a simple one for the jQuery stalwarts
  here.  I've recently moved over from Protoype and was used to using
  the update() function to replace text within a node - something like
  this:

  PROTOTYPE
  p id='dText'text to be replaced/p
  $('dText').update('New text string')

  JQUERY
  p id='dText'text to be replaced/p
  $('#dText').remove().append('New text string')

  Now it appears to me that in jQuery, there isn't an out of the box
  function to replace the contents of a node without also replacing the
  node too, hence the reason I am chaining remove() and append().  Is
  there a better way to achieve this?

  Many thanks

  George


[jQuery] Re: jQuery next() to find selectoption

2009-04-28 Thread George Adamson


Are you able to use the keyup event instead or does it need to be
keydown?
(Inside the keyup event handler the option:selected item should be the
one you're after, instead of having to derive it.)

Failing that could you just find the next/previous option by using
selectedIndex +/-1  ?
Something along the lines of...
var prevOrNext = e.keyCode == 37 ? -1 : e.keyCode == 39 ? 1 : 0;
if( prevOrNext ){
var $list = $(this).parents(SELECT);
var selIndex = $list.attr(selectedIndex) + prevOrNext;
location.href = $list.find(OPTION).eq(selIndex).val();
}

I dare say you can slim the code down a little!

George

 problem is I am using optgroup too and can't find a way to make it
 work


[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-26 Thread George Adamson

 so the name=someName has to be repeated for each value.

How about $([name=someName]).filter([value=someValue],
[value=otherValue]) ?

Cheers,
George


[jQuery] Re: Assigning a List of Key-Value Pairs to a DIV Tag

2009-04-22 Thread George Adamson

Hi Kiusau,

The other 2 suggestions should help.

You may also like to try using jQuery's.each method. Something like:

var flowerColor = {rose: red, tulip: pink, daffodil: yellow};

$.each(flowerColor, function(flower,color){
  this.append(Flower name and color:  + flower + : + color +
.br /);
});


On Apr 22, 6:08 am, kiusau kiu...@mac.com wrote:
 QUESTION:  Is it possible to use the for-in statement to list all of
 the key:value pairs of an object in a div tag?

 BACKGROUND:  The following code (see SOURCE CODE below) writes only
 the sentence:  Flower name and color:  daffodil:yellow.  The
 key:value pairs rose:red and tulip:pink appear to be written over each
 time the for-in statement iterates.  If I replace the this.html( );
 statement with a document.write( ); statement all three key:value
 pairs are written, but the entire rest of the document is obliterated.

 SOURCE CODE:

 (function($) {
         $.fn.writeColorOfFlower = function() {
                 var flowerColor = {rose: red, tulip: pink, daffodil: 
 yellow};
                 for (flower in flowerColor) {
                         this.html(Flower name and color:  + [flower] + : 
 + flowerColor
 [flower] + .br /);
                 }
                 return;
         }

 })(jQuery);

 $(document).ready(function() {
    $('#flowers').writeColorOfFlower();



 });- Hide quoted text -

 - Show quoted text -


[jQuery] Re: [Validate] plugin fails on Safari

2009-02-23 Thread George
Hi Jörn

Many thanks for your suggestion.  In fact the problem was an obvious
one that lay in the metadata.  I had a class name of 'date' in my
input field which was obviously clashing.  I had totally overlooked
that.

Many thanks for writing a very flexible plugin.

All the best

George



On Feb 18, 4:10 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Regular expressions are read to read, can't spot any obvious error
 with that, especially considering that it fails only in Safari.

 Here is a custom method for italian dates, not using regex, maybe it helps:

 jQuery.validator.addMethod(
         dateITA,
         function(value, element) {
                 var check = false;
                 var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
                 if( re.test(value)){
                         var adata = value.split('/');
                         var gg = parseInt(adata[0],10);
                         var mm = parseInt(adata[1],10);
                         var  = parseInt(adata[2],10);
                         var xdata = new Date(,mm-1,gg);
                         if ( ( xdata.getFullYear() ==  )  ( 
 xdata.getMonth () == mm -
 1 )  ( xdata.getDate() == gg ) )
                                 check = true;
                         else
                                 check = false;
                 } else
                         check = false;
                 return this.optional(element) || check;
         },
         Please enter a correct date
 );

 From:http://jquery.bassistance.de/validate/additional-methods.js

 Jörn

 On Wed, Feb 18, 2009 at 3:25 PM, George george.bea...@googlemail.com wrote:

  Hi Folks,

  Wondered if anyone could help on this, I've been stuck on it for quite
  some time.

  I'm trying to validate a date field using a UK date,  here's my code:

   $(document).ready(function(){
     $('#arrival-arrival-date').datepicker({ minDate: new Date
  (),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false });

                                 $.validator.addMethod('ukdate', 
  function(value, element) {

                                   var regex = 
  /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/]
  ((19|20)\d\d)$/;
                                                 
  console.log(value.match(regex));
       return this.optional(element) || value.match(regex);
       }, Please specify a UK date);

                                  // validate signup form on keyup and submit
     $(#theForm).validate({
                                     debug:true,
                                                                 errorClass: 
  'redBorder',
                                                                 rules: {
             'arrival-arrival-date': {
                 ukdate: true},
             'arrival-stay-duration': {
                 required: true,
                 min: 1}
           },
                                                                              
     highlight: function(element, errorClass) {
             $(element).fadeOut(function() {
               $(element).fadeIn()
                                                                              
                                     })
           },
                                                                              
     messages: {
                                                                              
      'arrival-arrival-date':'',
                                                                              
             'arrival-stay-duration':''
                                                                              
     },
                                                                          
  highlight: function(element, errorClass) {
                                                                              
                     $(element).addClass(errorClass);
                                                                              
     },
                                                                              
     unhighlight: function(element, errorClass) {
                                                                              
                     $(element).removeClass(errorClass);
                                                                              
     },
                                                                              
     errorPlacement: function(error, element) {
             error.appendTo('errorNotes');
           }
     });

  And you can see a demo of it in action at
 http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/.  It
  works fine on IE, Opera and FF, fails in Safari for any dates where
  the dd part is higher than 12.

  I think it must be an issue with the validator plugin as I've tested
  the regular expression on its own in Saari and it works fine.

  Cheers

  George

[jQuery] [jQuery][validate] plugin fails on Safari

2009-02-18 Thread George

Hi Folks,

Wondered if anyone could help on this, I've been stuck on it for quite
some time.

I'm trying to validate a date field using a UK date,  here's my code:

 $(document).ready(function(){
$('#arrival-arrival-date').datepicker({ minDate: new Date
(),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false });

$.validator.addMethod('ukdate', function(value, 
element) {

  var regex = 
/^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/]
((19|20)\d\d)$/;
console.log(value.match(regex));
  return this.optional(element) || value.match(regex);
  }, Please specify a UK date);

 // validate signup form on keyup and submit
$(#theForm).validate({
debug:true,
errorClass: 
'redBorder',
rules: {
'arrival-arrival-date': {
ukdate: true},
'arrival-stay-duration': {
required: true,
min: 1}
  },

highlight: function(element, errorClass) {
$(element).fadeOut(function() {
  $(element).fadeIn()

})
  },

messages: {

 'arrival-arrival-date':'',

'arrival-stay-duration':''

},
 
highlight: function(element, errorClass) {

$(element).addClass(errorClass);

},

unhighlight: function(element, errorClass) {

$(element).removeClass(errorClass);

},

errorPlacement: function(error, element) {
error.appendTo('errorNotes');
  }
});



And you can see a demo of it in action at
http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/.  It
works fine on IE, Opera and FF, fails in Safari for any dates where
the dd part is higher than 12.

I think it must be an issue with the validator plugin as I've tested
the regular expression on its own in Saari and it works fine.

Cheers

George


[jQuery] [Validate] plugin fails on Safari

2009-02-18 Thread George

Hi Folks,

Wondered if anyone could help on this, I've been stuck on it for quite
some time.

I'm trying to validate a date field using a UK date,  here's my code:

 $(document).ready(function(){
$('#arrival-arrival-date').datepicker({ minDate: new Date
(),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false });

$.validator.addMethod('ukdate', function(value, 
element) {

  var regex = 
/^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/]
((19|20)\d\d)$/;
console.log(value.match(regex));
  return this.optional(element) || value.match(regex);
  }, Please specify a UK date);

 // validate signup form on keyup and submit
$(#theForm).validate({
debug:true,
errorClass: 
'redBorder',
rules: {
'arrival-arrival-date': {
ukdate: true},
'arrival-stay-duration': {
required: true,
min: 1}
  },

highlight: function(element, errorClass) {
$(element).fadeOut(function() {
  $(element).fadeIn()

})
  },

messages: {

 'arrival-arrival-date':'',

'arrival-stay-duration':''

},
 
highlight: function(element, errorClass) {

$(element).addClass(errorClass);

},

unhighlight: function(element, errorClass) {

$(element).removeClass(errorClass);

},

errorPlacement: function(error, element) {
error.appendTo('errorNotes');
  }
});



And you can see a demo of it in action at
http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/.  It
works fine on IE, Opera and FF, fails in Safari for any dates where
the dd part is higher than 12.

I think it must be an issue with the validator plugin as I've tested
the regular expression on its own in Saari and it works fine.

Cheers

George


[jQuery] Performance suggestion: Use object hash instead of regexp

2009-02-03 Thread George Adamson

(This is really directed at the jQuery core team)

I notice that jQuery uses regexp statements like this one... (used in
the position() and offsetParent() methods for example)

.../^body|html$/i.test(offsetParent.tagName)

Might it be faster to use a simple object hash like this instead...?

var test = {BODY:true, HTML:true};
...test[offsetParent.tagName];

I did some crude experiments and found that the hash technique was at
least 4 times faster in IE7 and 15 times faster in FF3.

I've dumped some more info on http://blog.softwareunity.com/

I'm interested to hear people's opinions on this as a performance
booster.
(What shall I call it? Sizzle perhaps? No maybe that one's taken...)



[jQuery] Re: Performance suggestion: Use object hash instead of regexp

2009-02-03 Thread George Adamson

Absolutely, it is very very limited. So this technique is only suited
to the type of regex's that I quoted, like the one used internally by
jquery to test for body or html tags only, or to test for t(able|d|h)
only. Particulalry when used inside a loop. For parsing a selector we
still need regex.

On Feb 3, 3:16 pm, Eric Garside gars...@gmail.com wrote:
 Using a hash I can see for some situations, but unless you can figure
 out a way (and I'd be super interested if you could) to do complex
 cascade parsing without regex, your method seems like double the work
 of rewriting with no benefits towards maintainability and a minor
 speed increase for only certain tags.


[jQuery] Splitter plugin not responding to window resize in IE7

2009-01-19 Thread George Adamson

I'm using Dave Methvin's excellent splitter plugin to provide a 3-pane
splitter. (http://methvin.com/splitter)

Works a treat except that it does not respond to a window resize in
IE7.  Other browsers are ok, even IE6!
I've experimented with the anchorToWindow and resizeToWidth options
but they did not help.

Has anyone else had these symptoms?
Many thanks,
George


[jQuery] Re: Splitter plugin not responding to window resize in IE7

2009-01-19 Thread George Adamson


I may have found a solution for this: It seems that IE7 was getting
stuck on a couple of css background images. When I removed references
to those images, the splitter started to respond to window resize.
Very odd.

Here's a demo of the symptom: http://www.softwareunity.com/sandbox/splitterpage/
(Open in IE7 and resize the window. The bottom of the page does not
follow the window height as it does in IE6 and FF. They seem to open
the images ok.)

Cheers,
George

On Jan 19, 12:31 pm, George Adamson george.adam...@softwareunity.com
wrote:
 I'm using Dave Methvin's excellent splitter plugin to provide a 3-pane
 splitter. (http://methvin.com/splitter)

 Works a treat except that it does not respond to a window resize in
 IE7.  Other browsers are ok, even IE6!
 I've experimented with the anchorToWindow and resizeToWidth options
 but they did not help.

 Has anyone else had these symptoms?
 Many thanks,
 George


[jQuery] Re: How to split this?

2008-12-26 Thread George Adamson

... Or try this variation for the more jQuery obsessed...!

$.each( mystring.split(;), function(){
var values = this.split('/');
$( '#' + values[0] ).css({ top:+values[1], 
left:+values[2] });
})

... Or if you like regular expressions (and you don't mind abusing the
replace method to provide looping)...

mystring.replace(/([^\/]+)\/([^\/]+)\/([^\/]+);/g, function
($0,id,y,x){
$( '#' + id ).css({ top:y, left:x });
})

Cheers all and happy new year.

George


On Dec 26, 10:21 am, BroOf kontaktpl...@googlemail.com wrote:
 You're fantastic! Thank you so much it works just perfectly!

 Greetz: BroOf

 On 25 Dez., 21:10, Michael Geary m...@mg.to wrote:

  My take on it would be similar to Kristaps', with a couple of differences:

      var string = '1/17/52;2/283/-2;3/475/492;4/180/625;5/272/790;'
      var groups = string.split(';');
      for( var i = -1, group;  group = groups[++i]; ) {
          var values = group.split('/');
          $( '#' + values[0] ).css({ top:+values[1], left:+values[2] });
      }

  Also note that it's invalid for an ID attribute to begin with a digit:

 http://www.w3.org/TR/html401/types.html#h-6.2

  I think a numeric ID may work in a jQuery selector anyway, but I haven't
  tested it.

  -Mike

   From: BroOf

   Hey all! I build a function that creates a string with some
   informations. This is the structure:

   1/17/52;2/283/-2;3/475/492;4/180/625;5/272/790;

   looks a little bit confusion but it's really simple. The
   first letter/ number (1) is the ID of an Div. the second
   number (17) is it's Y coordinate and the third number (52) is
   it's X coordinate. Then it continues with the second div (ID
   2) and so on.
   My question now is: How do I split the informations into
   readable pieces? After splitting it should be placed with the
   .css function:

   $('#1').css( left, 52 );
   $('#1').css( top, 17);

   ...

   $('#5').css( left, 790);
   $('#5').css( top, 272);


[jQuery] Re: Problems with more than one AJAX request at a time

2008-12-13 Thread George

It has nothing to so with AJAX.
You did not say what you using on your server side so i can not tell.

But a lot of frameworks like ASP or ASP.NET will serialize requests
made from the same Sesssion (browser). To avoid programmers having to
manage concurent access to resources in Session object.


George.

On Dec 12, 1:48 pm, hotdog...@gmail.com hotdog...@gmail.com wrote:
 Hello there!

 I'm sending an AJAX request using jQuery that could take a minute to
 complete. However, I also want to send other smaller ajax requests to
 the same host at the same time just after the first one starts. The
 problem is, the smaller requests block until the first one finishes.
 Is there a way to get around that? Shouldn't AJAX be asynchronous?


[jQuery] Re: jQuery.data(name,value) returns jQuery?

2008-12-09 Thread George

I do not see where it says that.
.data(name,value)
puts a value in.

Usually any JQuery functions returns JQuery chain of objects.

So something like that can be done
$(div).data(test, { first: 16, last: pizza! }).addClass('red');


The $('div').data('test') will return you the value.

George

On Dec 9, 5:12 pm, mgl [EMAIL PROTECTED] wrote:
 The docs athttp://docs.jquery.com/Coresay that jQuery.data
 (name,value) should return the value, but instead it seems to be
 returning jQuery.  Is this what is supposed to happen?


[jQuery] Re: jQuery Tabs -- Are disjointed tabs possible?

2008-12-09 Thread George

not sure. Probably yes, but first you need to be able play with CSS so
static HTML can be aligned like that.

Try something like this.
ul id=tabs
liTab1/li
li style=float:rightTab2/li
li style=float:rightTab3/li
/ul

George.

On Dec 9, 4:54 pm, ripcurlksm [EMAIL PROTECTED] wrote:
 Is this possible with jQuery tabs? To seperate certain tabs and push them to
 the right?http://www.nabble.com/file/p20924502/Untitled-1.jpg
 --
 View this message in 
 context:http://www.nabble.com/jQuery-TabsAre-disjointed-tabs-possible--tp...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Autocomplete with JSON contacting the server frequently

2008-12-09 Thread George

I guess just out of the name 'Autocomlete' you could think that any
time you press a key in the input box the page is trying to complete
your sentence.
Hence sends request to the server.

Not sure why would you need a solution? Is it broken?

George.

On Dec 8, 11:30 am, R. Rajesh Jeba Anbiah
[EMAIL PROTECTED] wrote:
    I have noted that the JSON 
 version/usagehttp://jquery.bassistance.de/autocomplete/demo/json.htmlis 
 contacting
 the server frequently. The standard version is not unnecessarily
 contacting the server. It's contacting the server whenever a key is
 pressed. What could be the reason and any solution? TIA

 --
   ?php echo 'Just another PHP saint'; ?
 Email: rrjanbiah-at-Y!com    Blog:http://rajeshanbiah.blogspot.com/


[jQuery] Re: Simultaneous $.load() calls wait for eachother

2008-12-09 Thread George

I do not know about php but asp and asp.net serialize access to the
same Session. (basically same browser).
So it would be normal. And problem on server side.

George.

On Dec 9, 8:27 am, Robin Speekenbrink [EMAIL PROTECTED] wrote:
 I have a (stupid) problem: i have the follwing short script:
 $(window).load(function() {
         $(#div1).load('/xmlHttp.php?action=getLoad');
         $(#div2).load(/xmlHttp.php?action=+ $(input
 [name='selectType']).val());

 });

 What this does: it calls the central xmlHttp url to fetch data. Simple
 right? Except that the first call can stall the second? The second
 call will finish only when the first is already done?

 It seems that the second call waits for the first to be done? (ór its
 just a widly strange coincidence that the two calls each take the
 exact amount of time according to firebug)

 the overall settings are as follows:
 $.ajaxSetup({cache: false});

 If i rearrange the first call áfter the second the results are as
 expected: #div2 is filled quickly while div1 is still loading...

 Is this a bug or something else?


[jQuery] Re: IE7: loading XML per ajax

2008-11-25 Thread George

The error message does indicate that it does not like something about
XML.

Try folowing.
1. Save xml on your drive and simply open it with IE. See if it gives
you an error.
2. What does errorThrown points to?
3. The standalone=no not sure it's valid...

George.



On Nov 25, 3:56 pm, w-o-m [EMAIL PROTECTED] wrote:
 That's true. But a SVG is still just an XML file. I don't need IE to
 draw the grapic, I just need the data. My script, btw, doesn't work
 with other XML's either.



 ricardobeat wrote:
  IE7 doesn't support SVG afaik.

  On Nov 25, 6:08 am, w-o-m [EMAIL PROTECTED] wrote:
   Hello,

   I tried to load a .svg vector graphic with $.ajax, which works
   perfectly well in FF and Opera, but not in Internet Explorer.

   My script looks like this:

   $(document).ready(function(){
   $.ajax({
   type: GET,
   url: test.svg,
   dataType: xml,
   success: function(data){ parseSVG(data); },
   error: function(xhr, textStatus, errorThrown){ alert
   (textStatus); }
   });

   });

   function parseSVG(svg){
   /* function that parses the DOM of the file */

   }

   If I run this in IE7, the error function is called. The alert box then
   reads parsererror.

   The svg-file looks like this (renaming it into .xml makes no
   difference):

   ?xml version=1.0 encoding=UTF-8 standalone=no?
   svg
   path
   d=M 167.4375,684.375 L 165.96875,685.71875 z
   id=blablabla
   style=fill:#79b63f;fill-opacity:1; ... /
   path ... /
   path ... /
   /svg

   I assume, that IE doesn't like something about the xml, but I don't
   know what...- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
jQuery (English) group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~--~~~~--~~--~--~---



[jQuery] Re: .click vs. .bind

2008-11-23 Thread George

Just a note: The bind notation allows you to specify additional data
for your even handler function.
I am actually used to always use a .bind

George.

On Nov 23, 7:47 pm, Michael Geary [EMAIL PROTECTED] wrote:
 There is no difference at all.

 $(...).click( fn )

 is merely a shorthand for:

 $(...).bind( 'click', fn );

 You can see this in the code that creates .click() and the other shortcut
 methods:

 jQuery.each( (blur,focus,load,resize,scroll,unload,click,dblclick, +
     mousedown,mouseup,mousemove,mouseover,mouseout,change,select, +
     submit,keydown,keypress,keyup,error).split(,), function(i, name){

     // Handle event binding
     jQuery.fn[name] = function(fn){
         return fn ? this.bind(name, fn) : this.trigger(name);
     };

 });

 -Mike



  From: coughlinsmyalias

  What is the main difference between using .bind() and
  .click(), when I was reading up, it was mentioning it removes
  event bubbling?- Hide quoted text -

 - Show quoted text -


[jQuery] document.getElementById shortcut?

2008-11-23 Thread George

I found myself using document.getElementById often in my coding.
Is there a shortcut for it in JQuery?

PS: $('#id') is not a shortcut. Since $('#myimage').src will not work.
$('#myimage').attr('src') will but I think that
document.getElementById is when I do not need extensive JQuery
selection ability.
Plus it's
a) faster
b) I can always convert to JQuery collection if I need to do something
fancy like
var myelement = document.getElementById('myimage');
$(myelement).hide('slow');


PPS: so far i am thinking of creating my own $$('myimage')

Thanks
George.


[jQuery] Re: jquery in asp.net

2008-11-22 Thread George

A. JQuery always run on a client side. It has nothing to do with C# or
VB.NET. So no wonder that compiler gives you an error it simply does
not know what $(...) is.
B. You need to add to your page
script
 $('input#%=tbLogin.ClientId%).focus();
/script
The actuall ID of the tbLogin might be different ASP.NET generates
them to make sure the ID of the control on the page is unique.

C. For something that simple you can use tbLogin.Focus(); on a server
side. You do not need JQuery

George.


On Nov 22, 1:41 pm, lszk [EMAIL PROTECTED] wrote:
 I have a code in asp.net:

 body
    form id=form1 runat=server
    div id=container
        div id=login
            div class=window
                table
                    tr
                        td
                            Login:
                        /td
                        td
                            asp:TextBox ID=tbLogin runat=server/
 asp:TextBox
                            asp:RequiredFieldValidator ID=rfvLogin
 runat=server
                                ControlToValidate=tbLogin
 ErrorMessage=Musisz podać login/asp:RequiredFieldValidator
                        /td
                    /tr
 etc.

 I'm using firebug, and now I want to set focus on tbLogin. When I open
 it on the server and I write $('input#tbLogin').focus();
 I have a error: $('input#tbLogin').focus();

 TypeError: $(input#tbLogin) is undefined login.aspx (line 65)

 but when I save a generated html and open this saved file, it works
 fine. $('input#tbLogin').focus();

 Object length=1

 Where I made a mistake?


[jQuery] Do i need to unbind event before removing DOM element

2008-11-21 Thread George

I am creating dynamicly span tag and binding click event.
$('#myspan').bind('click', param, myFunc);

Then at some point this span is removed using JQuery. Do i need to
unbind click event first?
Or it's ok and Javascript will clean that up automaticly..

George.


[jQuery] Re: asp.net and jquery - reactions to this letter

2008-11-19 Thread George Adamson

I'm very surprised by his comments. We always rely on jQuery to get
grips with the monster that is ASP.Net+AJAX.Net, regardless of project
size.

jQuery's extraordiary convenience requires a slightly different
mindset from conventional .net languages (one that I miss on the
server side!) so perhaps the author could use some help to learn more
about it.

On Nov 18, 9:52 pm, rolfsf [EMAIL PROTECTED] wrote:
 is it truly a monster?
 http://reddevnews.com/response/response.aspx?rdnid=1189


[jQuery] Re: Need to reference an object enbedded in a $this

2008-11-19 Thread George

you can do
$('a', $(this)).css(color, red);

But it will change all A links

George

On Nov 19, 7:18 pm, lwoods [EMAIL PROTECTED] wrote:
 I have an action function where I have $(this).  Now I need to change the css
 for a link ( ) that is inside the $(this) .  How do I reference it?  In my
 example, the $(this) references a div and I want to change the text color
 in a   that is within this div.

 
 --
 View this message in 
 context:http://www.nabble.com/Need-to-reference-an-object-enbedded-in-a-%24th...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Need to reference an object enbedded in a $this

2008-11-19 Thread George

I meant all A links inside that DIV the one that is in $(this)

On Nov 19, 11:14 pm, George [EMAIL PROTECTED] wrote:
 you can do
 $('a', $(this)).css(color, red);

 But it will change all A links

 George

 On Nov 19, 7:18 pm, lwoods [EMAIL PROTECTED] wrote:



  I have an action function where I have $(this).  Now I need to change the 
  css
  for a link ( ) that is inside the $(this) .  How do I reference it?  In my
  example, the $(this) references a div and I want to change the text color
  in a   that is within this div.

  
  --
  View this message in 
  context:http://www.nabble.com/Need-to-reference-an-object-enbedded-in-a-%24th...
  Sent from the jQuery General Discussion mailing list archive at 
  Nabble.com.- Hide quoted text -

 - Show quoted text -


[jQuery] Re: ASP.NET C# jquery treeview

2008-11-18 Thread George

I see,
the most common way to return JSON is to use [WebMethod]

example (in C#)

[System.Web.Services.WebMethod(EnableSession = true)]
public static object Fetch()
{
   clsMyObject a = new clsMyObject;
   a.Name=George';
   return a;
}

PS: you need EnableSession = true obly if you using Session variable
in your method.
George.

On Nov 18, 9:34 am, mthakershi [EMAIL PROTECTED] wrote:
 What I wanted to know is:

 In PHP example, on client side it says something like url: sources.php
 and then sources.php file returns JSON treeview nodes. What would be
 the server-side equivalent in ASP.NET for that? I am not able to find
 any example for that.

 Thank you for your help.

 On Nov 17, 7:21 pm, George [EMAIL PROTECTED] wrote:



  I am not sure i understandWhat is the exact problem?

  JQuery is 100% client side... ASP.NET is 100% server side...

  You should not have a problem to generate HTML with ASP.NET and use it
  with JQuery tree  plugin

  The only this i can guess you having a problem with is IDs since
  ASP.NET generates it's own elemnet's IDs. But you can use class if you
  want.. Or not mark items as runat=server then ID's will be the ones
  that you assigned.

  George.

  On Nov 17, 8:00 pm, mthakershi [EMAIL PROTECTED] wrote:

   Hi, I am trying to implement JQuery treeview with asp.net. I have
   master page and treeview is in child page. Can someone point me to an
   example that shows ASPX integration? I saw PHP one but I am not able
   to replicate the same thing in ASP.NET.

   Any help is appreciated.

   Thank you.- Hide quoted text -

 - Show quoted text -


[jQuery] Re: ASP.NET C# jquery treeview

2008-11-18 Thread George

1. Check if you hit this URl with a browser what happens...

2. ASP.NET embeds securite measures into what can be POSTed to ASP.NET
page.
in web.config set pages validateRequest=false

3. Please see my POST 
http://groups.google.com/group/jquery-en/browse_thread/thread/a2f65e23c7f60e06?hl=en#
Your method might have problems. You need to read InputStream
completelly

George.

On Nov 18, 2:14 pm, mthakershi [EMAIL PROTECTED] wrote:
 Well.. I understand that. But it doesn't look that simple. I am not
 able to get the tree view example to work with ASP.NET. Here is the
 post I wrote in one other forum. Please see if you can help.

 Hello, I am not able to get this sample to work. It is driving me
 crazy. I think it is about setting up environment because it is not
 even calling the server-side page in debug mode. Please help.

 I have included necessary jQuery files in my project. I am right now
 trying on a sample page.

 Here is my HTML page:

 1    %@ Page Language=C# AutoEventWireup=true
 CodeBehind=SampleJson.aspx.cs Inherits=TeleHealth.SampleJson %
 2
 3    !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 4    html xmlns=http://www.w3.org/1999/xhtml;
 5    head runat=server
 6        titleUntitled Page/title
 7        link href=Resources/Styles/jquery.treeview.css
 rel=stylesheet type=text/css /
 8
 9        script type=text/javascript src=Resources/JS/
 jquery-1.2.6.js/script
 10
 11       script type=text/javascript src=Resources/JS/
 jquery.cookie.js/script
 12
 13       script type=text/javascript src=Resources/JS/
 jquery.treeview.async.js/script
 14
 15       script type=text/javascript src=Resources/JS/
 jquery.treeview.js/script
 16
 17       script type=text/javascript
 18
 19      function initTrees() {
 20              $(#black).treeview({
 21                      url: GetTreeData.aspx
 22              })
 23
 24              $(#mixed).treeview({
 25                      url: GetTreeData.aspx,
 26                      // add some additional, dynamic data and request with 
 POST
 27                      ajax: {
 28                              data: {
 29                                      additional: function() {
 30                                              return yeah:  + new Date;
 31                                      }
 32                              },
 33                              type: post,
 34                   data: {},
 35                   contentType: application/json; charset=utf-8,
 36                   dataType: json
 37                      }
 38              });
 39      }
 40
 41      $(document).ready(function(){
 42              initTrees();
 43      });
 44       /script
 45
 46   /head
 47   body
 48       h4
 49           Lazy-loading tree/h4
 50       ul id=black
 51       /ul
 52       h4
 53           Mixed/h4
 54       ul id=mixed
 55           lispanItem 1/span
 56               ul
 57                   lispanItem 1.0/span
 58                       ul
 59                           lispanItem 1.0.0/span/li
 60                       /ul
 61                   /li
 62                   lispanItem 1.1/span/li
 63               /ul
 64           /li
 65           li id=36 class=hasChildrenspanItem 2/span
 66               ul
 67                   lispan class=placeholder /span/li
 68               /ul
 69           /li
 70           lispanItem 3/span /li
 71       /ul
 72   /body
 73   /html
 74

 Here is my server-side code:

 1    namespace TeleHealth
 2    {
 3        public partial class GetTreeData : System.Web.UI.Page
 4        {
 5            protected void Page_Load(object sender, EventArgs e)
 6            {
 7                string pStrReply = [     {               \text\: \1. 
 Review of
 existing structures\,             \expanded\: true,           
 \children\:         [                       {
 \text\: \1.1 jQuery core\                       },                      { 
                               \text\: \1.2 metaplugins
 \                 }               ]       },      {               \text\: 
 \2. Wrapper plugins\    },      {               \text\: \3.
 Summary\  },      {               \text\: \4. Questions and answers\     
  }       ];
 8
 9                //Response.ContentType = application/json;
 10               Response.CacheControl = no-cache;
 11               Response.Clear();
 12               Response.Write(pStrReply);
 13               Response.End();
 14
 15               pStrReply = null;
 16           }
 17       }
 18   }
 19

 Any help is appreciated.

 On Nov 18, 11:03 am, George [EMAIL PROTECTED] wrote:



  I see,
  the most common way to return JSON is to use [WebMethod]

  example (in C#)

      [System.Web.Services.WebMethod(EnableSession = true)]
      public static object Fetch()
      {
         clsMyObject a = new clsMyObject;
         a.Name=George';
         return a;
      }

  PS: you need EnableSession = true obly if you using Session

[jQuery] Re: Jquery + Struts

2008-11-18 Thread George

I'll try to answer.
I do not know what 'struts' is. but you have made major mistake in
your wishes.

AJAX submit the data to the server and gets server's response.
It's your responsibility to collect data for AJAX call and parse out
server's response.

So you correctly put return false to prevent submitting the form
through regular means by the browser but failed to collect data and
parse it out.

To collect data from the form plug-in will help.

As to parse it out you will have to do it yourself. Since first you
need to define the in which data structure you returning data from the
server.
I recommend JSON

George.





On Nov 18, 7:35 pm, Bhavin [EMAIL PROTECTED] wrote:
 Hi,

 I am using JQuery with Struts 1.1. I am using following code when
 user
 clicks on Save button:

  $('#save').click(function() {
            $.blockUI({ message: h1Please wait.../h1 });

            $.ajax({
                url: '/saveData.do?dispatch=save',
                type:'post',
                cache: false,
                dataType:'xml',
                complete: function() {
                    $.unblockUI();
                }
            });

 Following is my struts code:

 body onload=
         html:form action=/saveTemplate.htm?dispatch=save
 method=POST
         div id=firstchildcontainer
                 Name: html:text property=templateName/
                 Description: html:textarea property=description
 rows=8
 cols=10/
                 html:submit styleId=savebean:message
 key=button.save//
 html:submit
                 html:cancel styleId=cancelbean:message
 key=button.cancel//
 html:cancel
         /div
         /html:form
 /body

 The problem here is it is submitting request twice because it is
 defined with struts form and with url (in ajax). How can I avoid
 duplicate request?

 I tried return false in click event but then actionform is not
 populated from jsp fields.

 Can anyone give working example of Jquery + Struts 1 ?

 Thanks,
 Bhavin


[jQuery] Re: ASP.NET C# jquery treeview

2008-11-17 Thread George

I am not sure i understandWhat is the exact problem?

JQuery is 100% client side... ASP.NET is 100% server side...

You should not have a problem to generate HTML with ASP.NET and use it
with JQuery tree  plugin

The only this i can guess you having a problem with is IDs since
ASP.NET generates it's own elemnet's IDs. But you can use class if you
want.. Or not mark items as runat=server then ID's will be the ones
that you assigned.

George.

On Nov 17, 8:00 pm, mthakershi [EMAIL PROTECTED] wrote:
 Hi, I am trying to implement JQuery treeview with asp.net. I have
 master page and treeview is in child page. Can someone point me to an
 example that shows ASPX integration? I saw PHP one but I am not able
 to replicate the same thing in ASP.NET.

 Any help is appreciated.

 Thank you.


[jQuery] Re: FCKEditor plugin stopped working in Firefox 3.0.4

2008-11-17 Thread George

Works for me... I have FF 3.0.4

George..

On Nov 17, 7:41 pm, Jack Killpatrick [EMAIL PROTECTED] wrote:
 I found the other day that the FCKEditor plugin:

 http://www.fyneworks.com/jquery/FCKEditor/

 doesn't work with Firefox 3.0.4. I'm looking into it now, but maybe
 someone already knows why? I suspect it has something to do with the way
 it hooks into the ajaxSubmit function of the jQuery Form plugin.

 TIA,
 Jack


[jQuery] Re: $.ajax POST with JSON in IE6

2008-11-17 Thread George

I just ended my 2 days 'dance' with IE Ajax and POST

refer to this post if you need more info.
http://groups.google.com/group/jquery-en/browse_thread/thread/a2f65e23c7f60e06?hl=en#

Might be not your case but with checking.

George.


On Nov 17, 3:27 pm, Reepsy [EMAIL PROTECTED] wrote:
 I am sorry I cannot link to example pages due to security
 restrictions. So will do my best to describe the problem with comments
 in my JS.

 Firstly, I am using jQuery with jqModal to load a page partial into a
 modal window. That page partial contains a form. When it is submitted,
 I am capturing that info and submitting it via $.ajax() using 'POST'.
 The backend script does its business, and returns some json, which is
 written to the modal.

 This all works perfectly in FF, Safari and IE7. Just not IE6. It
 doesn't return any json at all. Further, when I look at my logs, there
 is not even a POST request for the page in question, when using IE6.

 Here's the jist of it with /* COMMENTS

 /*LOAD A PAGE PARTIAL INTO THE MODAL
 $('#modal-content').load($l).ajaxStop(function() {
   /* IF THERE IS A FORM IN THE MODAL
   if ($(this).children('form').length  0 ) {
     /* ATTACH THIS TO SUBMIT EVENT
     $(this).children('form').submit(function() {
       /* SERIALIZE THE FORM
       var $s = $(this).serialize();
       /* GET NAME/VALUE PAIR OF SUBMIT BUTTON (THEY ARENT ALWAYS TEH
 SAME FROM PAGE TO PAGE)
       var $submit = $('input[type=submit]').attr('name');
       /* ADD IT NAME/VALUES (jQuery serialze() DOESN'T ASSUME THIS
 PAIR)
       $s += '' + $submit + '=' + $submit;
       $.ajax({
         /* CACHING OFF FOR IE
         cache: false,
         /* MY DATA
         data: $s,
         /* I WANT JSON BACK
         dataType: 'json',
         /* UPDATE MODAL ON SUCCESS
         success: function(data) {
           if(data.flash) {
             $('div.flash, #spinner').remove();
             if(data.flash.classname != 'error') { $('#modal-
 content').html(''); }
             $('#modal-content').prepend('div class=flash/div');
             $('div.flash').addClass(data.flash.classname).html
 (data.flash.message);
           }
           if(data.message) { $('#modal-content').append
 (data.message); }
           if(data.refresh) { window.location.reload(); }
         },
         /* MAKE IT A POST
         type: 'POST',
         /* THE BACKEND SCRIPT
         url: $(this).attr('action')
       });
       /* HIJACK THE FORM SUBMIT
       return false;
     });
   }

 });

 So I have isolated some scoping issues where IE6 doesn't know what $s
 and $(this).attr('action') are when we are inside the $.ajax() bit. So
 I hard coded correct values for them and tried again. Still nothing
 returned, nor any evidence of a POST made to the page in question.
 Finally, I changed my dataType to this:

 dataType: ($.browser.msie) ? 'text' : 'json'

 Then, I get can at least get a reponse back from the backend, and I
 see that a POST request was made for the backend script. But that is
 not what I need. I need to get JSON back. The backend script
 absolutely detects JSON requests and returns them in kind for all
 other browser combos. Any idea why not for IE6?

 Also, what is wrong with my scope that $.ajax() doesn't know what $s
 and $(this).attr('action') are in IE6?


[jQuery] Re: FCKEditor plugin stopped working in Firefox 3.0.4

2008-11-17 Thread George

It does load. and seems to be working although the Ajax submission
does not do anything.
But there is a note
Ajax Submission (DIV). This type of submission would not work without
this plugin.

So i thought plugin is not there so it's not working...

George.


On Nov 17, 9:29 pm, Jack Killpatrick [EMAIL PROTECTED] wrote:
 Hmm. In my case the FCK editor won't load. In the case of the link below the 
 ajaxSubmit test doesn't work for me.
 Both work for you on that page?
 Thx,
 Jack
 George wrote:Works for me... I have FF 3.0.4 George.. On Nov 17, 7:41 pm, 
 Jack Killpatrick[EMAIL PROTECTED]wrote:I found the other day that the 
 FCKEditor plugin:http://www.fyneworks.com/jquery/FCKEditor/doesn't work with 
 Firefox 3.0.4. I'm looking into it now, but maybe someone already knows why? 
 I suspect it has something to do with the way it hooks into the ajaxSubmit 
 function of the jQuery Form plugin. TIA, Jack


[jQuery] Re: PrettyCheckboxes not working with radio array names

2008-11-14 Thread George

Here is what i found
http://www.quirksmode.org/dom/w3c_core.html#microsoft
Scroll down to getElementsByName() section
According to it the getElementsByName() is supported pretty well,
except some minor things whcih is usually not the case anyway.

Like in Opera div id='name' will be returned as well..
So you just need to make sure that you do not have extra tags with the
same id as the name you assigned to your radio control.

George

On Nov 13, 11:22 pm, Ahhk [EMAIL PROTECTED] wrote:
 Brilliant! I'll take any incompatibilities of getElementByName over the
 totally broken radios any day!

 I never thought to change that to a standard method.

 Thank you so much. That was driving me nuts!





 George-147 wrote:

  I just had a wild idea and it looks like working

  replace following code in prettyCheckboxes
  $('input[name='+$toCheck.attr('name')+']').each(function(){
                $('label[for=' + $(this).attr('id')+']').removeClass
  ('checked');
  });

  with

  $(document.getElementsByName($toCheck.attr('name'))).each(function(){
     $('label[for=' + $(this).attr('id')+']').removeClass('checked');
  });

  I basically replace the $('input[name='+$toCheck.attr('name')+']')
  with
  $(document.getElementsByName($toCheck.attr('name')))

  wich is the same thing. And it's working now But i do not know
  about compatibilities of getElementsByName
  Works in FF 3 and IE 7 not sure about all other safari 

  George.

  On Nov 13, 6:12 pm, Ahhk [EMAIL PROTECTED] wrote:
  Wow, ok...thanks!

  I didnt think it was a jQuery issue and am surprised that jQuery, with as
  robust and fantastic as it is, wouldn't support array names for form
  elements.

  That seems like a major oversight to me :/

  But, maybe I'm one of only a few people who actually use array names/IDs.
  hr.

  It's SO much easier processing the data that way (numerically) instead of
  having to concatenate var names.

  George-147 wrote:

   I am with you now
   the problem is that you have weird name, with '[]' in it.

   this line
   $('input[name='+$toCheck.attr('name')+']')
   fails and returns empty collection.

   The problem is described here
  http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_...

   Unfortunatelly i failed to make it work with the solution there i am
   afraid that to many [] in the selector confusing JQuery. In their
   example they did it with the id so there were no additional [ ]
   brackets.
   $('input[name=q\\[1\\]]') returns me empty collection as well..

   but you might try to ask this group more specific question on how to
   make JQuery selectors work with the name like that q[1]

   George.

   Ahhk wrote:
   Thanks, but I didnt say I didnt want them to have the same name, I
  said
   that
   the script didnt work when the names were arrays.

   When the radio button groups have an name with an array, the script
   breaks
   and you can select/deselect multiple radio buttons within the group.

   Here's an example:

   label for=q1-11/labelinput type=radio name=q[1] value=1
   id=q1-1 /
   label for=q1-22/labelinput type=radio name=q[1] value=2
   id=q1-2 /
   label for=q1-33/labelinput type=radio name=q[1] value=3
   id=q1-3 /
   label for=q1-44/labelinput type=radio name=q[1] value=4
   id=q1-4 /

   label for=q2-11/labelinput type=radio name=q[2] value=1
   id=q2-1 /
   label for=q2-22/labelinput type=radio name=q[2] value=2
   id=q2-2 /
   label for=q2-33/labelinput type=radio name=q[2] value=3
   id=q2-3 /
   label for=q2-44/labelinput type=radio name=q[2] value=4
   id=q2-4 /

   label for=q3-11/labelinput type=radio name=q3 value=1
   id=q3-1
   /
   label for=q3-22/labelinput type=radio name=q3 value=2
   id=q3-2
   /
   label for=q3-33/labelinput type=radio name=q3 value=3
   id=q3-3
   /
   label for=q3-44/labelinput type=radio name=q3 value=4
   id=q3-4
   /

   label for=q4-11/labelinput type=radio name=q4 value=1
   id=q4-1
   /
   label for=q4-22/labelinput type=radio name=q4 value=2
   id=q4-2
   /
   label for=q4-33/labelinput type=radio name=q4 value=3
   id=q4-3
   /
   label for=q4-44/labelinput type=radio name=q4 value=4
   id=q4-4
   /

   The first two groups DONT work right, but the last two groups DO work.

   array name: q[4] vs non-array name: q4

   With the first two groups, I can select all or some of the radio
  buttons
   in
   the group. This appears to be purely a cosmetic/UI issue since only
  the
   value of the last one selected in the group gets submitted in the post
   (as
   it should).

   Something in the script doesnt support the array names.

   George-147 wrote:

Sorry instead of Why do you want to give them the same name?

I meant to say Why do you not want to give them the same name?

George.

On Nov 13, 3:06 pm, George [EMAIL PROTECTED] wrote:
The problem that regular radio buttons are working only when they
  have
the same name.
No wonder prettty ones not working too... :)

Why do you want

[jQuery] AJAX with IE and method POST

2008-11-14 Thread George

Hi guys/girls,
I just wanted to post here my problems (and solution) I had been
struggling with last 2 days.

I was doing JQuery AJAX POST and it was not working in IE wile working
in FireFox.
Sometimes you will get 12030 error (Server unexpectedly terminated
connection) from IE's XMLHttpRequest object.


I discovered that in order for IE's XMLHttpRequest object to properly
read return stream the input stream must be completely read by the
server (even if you are not interested in it).

Some frameworks do it automatically and some do not. For example
ASP.NET does not do it automatically.
I was trying to do POST to .ashx handler and was getting errors.

So adding this code to my handler fixed the problem.

System.IO.Stream st = context.Request.InputStream;
byte []buf = new byte[100];
while (true)
{
int iRead = st.Read(buf, 0, 100);
if( iRead == 0 )
break;
}
st.Close();


So I am just posing it for Google to spider it and people to be able
to find it. Cause when I googled I found a lot of people having
problem with 12030 error but no solution.

Good luck,
George


[jQuery] Re: AJAX with IE and method POST

2008-11-14 Thread George

No i did not...I did pass exactly this '{}' (empty JSON data).

As i said the problem was that i were not reading the InputStream till
the end cause i knew that data would be empty. And it messes up IE's
XMLHttpRequest object so it can not read properly output from the
server.


George.

On Nov 14, 2:22 pm, Mike Nichols [EMAIL PROTECTED] wrote:
 did you forget to pass data (data:{}) in the ajax call? I have had
 that trip me up when doing posts via ajax.

 On Nov 14, 10:35 am, George [EMAIL PROTECTED] wrote:



  Hi guys/girls,
  I just wanted to post here my problems (and solution) I had been
  struggling with last 2 days.

  I was doing JQuery AJAX POST and it was not working in IE wile working
  in FireFox.
  Sometimes you will get 12030 error (Server unexpectedly terminated
  connection) from IE's XMLHttpRequest object.

  I discovered that in order for IE's XMLHttpRequest object to properly
  read return stream the input stream must be completely read by the
  server (even if you are not interested in it).

  Some frameworks do it automatically and some do not. For example
  ASP.NET does not do it automatically.
  I was trying to do POST to .ashx handler and was getting errors.

  So adding this code to my handler fixed the problem.

  System.IO.Stream st = context.Request.InputStream;
          byte []buf = new byte[100];
          while (true)
          {
              int iRead = st.Read(buf, 0, 100);
              if( iRead == 0 )
                  break;
          }
          st.Close();

  So I am just posing it for Google to spider it and people to be able
  to find it. Cause when I googled I found a lot of people having
  problem with 12030 error but no solution.

  Good luck,
  George- Hide quoted text -

 - Show quoted text -


[jQuery] Re: Bug with AJAX json setting an element to a value and back to 0 when polling

2008-11-14 Thread George

Somehow i do not think it has anything to do with JSON.
Nobody analyzes passed values on client.

With AJAX there are 2 to tango :)
I think it's the server side that has a problem...

George.


On Nov 14, 6:00 pm, Technocrat [EMAIL PROTECTED] wrote:
 I am using the AJAX class with the dataType set to json and cache off.
 I am polling with the this class about every 2 minutes.

 So here what I am doing to get the error and it is reproducible.  I
 have everything set really simply right now.

 Here is the success function I am using:
 function(data) {
   alert(data.id);}

 It just set to alert so I can see what's going on.

 Here is the first JSON data getting passed to it:
 {name:,id:0}

 And I get an alert that says 0.  So far so good.

 Next poll I get:
 {name:test,id:22}

 And I get an alert that says 22.  Still fine.

 Next poll I get:
 {name:,id:0}

 I get an alert of 22!?  Which is wrong.

 Next poll I get:
 {name:test2,id:23}

 And I get an alert that says 23.  Ok back on track.

 Next poll I get:
 {name:,id:0}

 I get an alert of 23!?  Which is wrong again.

 So for some reason if a value gets set to 0 it doesn't send back a
 proper 0 it send back a previous value.  I changed from json to text
 to make sure the data was correct and it shows correctly on each
 poll.  So this appears to be a json only issue.

 My guess is there is a not equal statement some where that is not
 correct.


[jQuery] Re: blockUI:

2008-11-13 Thread George

you just need to change $.blockUI to $('#mytagid').bockUI. The sasme
with unblock call.

George

On Nov 13, 12:07 pm, pixeline [EMAIL PROTECTED] wrote:
 Hi!

 My website uses ajax to refresh various elements in the course of the
 user's navigation. I would like to display a please wait message in
 the element being refreshed and blockUI is the perfect candidate for
 that.

 However, there are many elements concerned, and i would like to
 systematize the blockUI calls.

 In blockui doc, there is a nice simple way to systematize its use:

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

 Now, i would like to know if it is possible to customize this call so
 that the concerned element shows blockUI, instead of the whole page ?

 Thank you !

 Alexandre


[jQuery] Re: blockUI:

2008-11-13 Thread George

Ok, now i am not sure what exactly is a problem... sorry.


You can call this code
$().ajaxStart($('#mydiv').blockUI).ajaxStop($('#mydiv').unblockUI);

as many time as you want.
It only changes which function will be called once AJAX is doing the
call..

So right before doing your ajax call to the
$().ajaxStart($('#mydiv').blockUI).ajaxStop($('#mydiv').unblockUI);

Or you can create your own function wrapper that does the AJAX call

function DoTheCall(element)
{
$().ajaxStart($(element).blockUI).ajaxStop($(element).unblockUI);
$.ajax(.); //the actual ajax call
}

George,

On Nov 13, 12:15 pm, Alexandre Plennevaux [EMAIL PROTECTED]
wrote:
 hi Georges,
 yes, but the problem is that i don't know which element is concerned
 by the call (unless i hardcode it each time of course, but that's what
 i would like to avoid).

 Thanks for your input nonetheless.



 On Thu, Nov 13, 2008 at 6:12 PM, George [EMAIL PROTECTED] wrote:

  you just need to change $.blockUI to $('#mytagid').bockUI. The sasme
  with unblock call.

  George

  On Nov 13, 12:07 pm, pixeline [EMAIL PROTECTED] wrote:
  Hi!

  My website uses ajax to refresh various elements in the course of the
  user's navigation. I would like to display a please wait message in
  the element being refreshed and blockUI is the perfect candidate for
  that.

  However, there are many elements concerned, and i would like to
  systematize the blockUI calls.

  In blockui doc, there is a nice simple way to systematize its use:

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

  Now, i would like to know if it is possible to customize this call so
  that the concerned element shows blockUI, instead of the whole page ?

  Thank you !

  Alexandre- Hide quoted text -

 - Show quoted text -


[jQuery] Re: PrettyCheckboxes not working with radio array names

2008-11-13 Thread George

The problem that regular radio buttons are working only when they have
the same name.
No wonder prettty ones not working too... :)

Why do you want to give them the same name?
You can use different ids if you want. Something like this

input type=rario name=group1 id=group1_1
input type=rario name=group1 id=group1_2
input type=rario name=group1 id=group1_3


George.

On Nov 12, 2:05 pm, Ahhk [EMAIL PROTECTED] wrote:
 Anyone know how to fix this?

 --
 View this message in 
 context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


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

2008-11-13 Thread George

It does not seem to work...
I had tried in FF 3.03 and IE 7.0
In both browsers nothing happens...

George.

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

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

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

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

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

   Regards,

 ~ Brice


[jQuery] Re: PrettyCheckboxes not working with radio array names

2008-11-13 Thread George


Sorry instead of Why do you want to give them the same name?

I meant to say Why do you not want to give them the same name?

George.


On Nov 13, 3:06 pm, George [EMAIL PROTECTED] wrote:
 The problem that regular radio buttons are working only when they have
 the same name.
 No wonder prettty ones not working too... :)

 Why do you want to give them the same name?
 You can use different ids if you want. Something like this

 input type=rario name=group1 id=group1_1
 input type=rario name=group1 id=group1_2
 input type=rario name=group1 id=group1_3

 George.

 On Nov 12, 2:05 pm, Ahhk [EMAIL PROTECTED] wrote:



  Anyone know how to fix this?

  --
  View this message in 
  context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n...
  Sent from the jQuery General Discussion mailing list archive at 
  Nabble.com.- Hide quoted text -

 - Show quoted text -


[jQuery] Re: has anyone come across a plugin like this ?

2008-11-13 Thread George

Count me in for the Plug-In request :)

It's pretty cool and the whole site is done very well, I put it in to
my Favorites so later I could revisit and 'steal' some design ideas.

PS: I am a .NET developer myself and so far find it to be more
superior (if I can say that) to Perl.
The problem you might have is only because of lack of experience
with .NET (no offence). The more you program on .NET the more you
going to like it.
I am talking from experience here. I was bitching and complaining
couple years ago... now I would refuse to work if it's not on .NET

There is nothing in .NET that prevents you from doing things like they
done in Perl.
So do not be down on it :)


George.


[jQuery] Re: PrettyCheckboxes not working with radio array names

2008-11-13 Thread George

I am with you now
the problem is that you have weird name, with '[]' in it.

this line
$('input[name='+$toCheck.attr('name')+']')
fails and returns empty collection.

The problem is described here
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F

Unfortunatelly i failed to make it work with the solution there i am
afraid that to many [] in the selector confusing JQuery. In their
example they did it with the id so there were no additional [ ]
brackets.
$('input[name=q\\[1\\]]') returns me empty collection as well..

but you might try to ask this group more specific question on how to
make JQuery selectors work with the name like that q[1]

George.


Ahhk wrote:
 Thanks, but I didnt say I didnt want them to have the same name, I said that
 the script didnt work when the names were arrays.

 When the radio button groups have an name with an array, the script breaks
 and you can select/deselect multiple radio buttons within the group.

 Here's an example:

 label for=q1-11/labelinput type=radio name=q[1] value=1
 id=q1-1 /
 label for=q1-22/labelinput type=radio name=q[1] value=2
 id=q1-2 /
 label for=q1-33/labelinput type=radio name=q[1] value=3
 id=q1-3 /
 label for=q1-44/labelinput type=radio name=q[1] value=4
 id=q1-4 /

 label for=q2-11/labelinput type=radio name=q[2] value=1
 id=q2-1 /
 label for=q2-22/labelinput type=radio name=q[2] value=2
 id=q2-2 /
 label for=q2-33/labelinput type=radio name=q[2] value=3
 id=q2-3 /
 label for=q2-44/labelinput type=radio name=q[2] value=4
 id=q2-4 /

 label for=q3-11/labelinput type=radio name=q3 value=1 id=q3-1
 /
 label for=q3-22/labelinput type=radio name=q3 value=2 id=q3-2
 /
 label for=q3-33/labelinput type=radio name=q3 value=3 id=q3-3
 /
 label for=q3-44/labelinput type=radio name=q3 value=4 id=q3-4
 /

 label for=q4-11/labelinput type=radio name=q4 value=1 id=q4-1
 /
 label for=q4-22/labelinput type=radio name=q4 value=2 id=q4-2
 /
 label for=q4-33/labelinput type=radio name=q4 value=3 id=q4-3
 /
 label for=q4-44/labelinput type=radio name=q4 value=4 id=q4-4
 /



 The first two groups DONT work right, but the last two groups DO work.

 array name: q[4] vs non-array name: q4

 With the first two groups, I can select all or some of the radio buttons in
 the group. This appears to be purely a cosmetic/UI issue since only the
 value of the last one selected in the group gets submitted in the post (as
 it should).

 Something in the script doesnt support the array names.






 George-147 wrote:
 
 
 
  Sorry instead of Why do you want to give them the same name?
 
  I meant to say Why do you not want to give them the same name?
 
  George.
 
 
  On Nov 13, 3:06 pm, George [EMAIL PROTECTED] wrote:
  The problem that regular radio buttons are working only when they have
  the same name.
  No wonder prettty ones not working too... :)
 
  Why do you want to give them the same name?
  You can use different ids if you want. Something like this
 
  input type=rario name=group1 id=group1_1
  input type=rario name=group1 id=group1_2
  input type=rario name=group1 id=group1_3
 
  George.
 
  On Nov 12, 2:05 pm, Ahhk [EMAIL PROTECTED] wrote:
 
 
 
   Anyone know how to fix this?
 
   --
   View this message in
  context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n...
   Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.- Hide quoted text -
 
  - Show quoted text -
 
 

 --
 View this message in context: 
 http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-names-tp20412719s27240p20490058.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: PrettyCheckboxes not working with radio array names

2008-11-13 Thread George

I just had a wild idea and it looks like working

replace following code in prettyCheckboxes
$('input[name='+$toCheck.attr('name')+']').each(function(){
  $('label[for=' + $(this).attr('id')+']').removeClass
('checked');
});


with

$(document.getElementsByName($toCheck.attr('name'))).each(function(){
$('label[for=' + $(this).attr('id')+']').removeClass('checked');
});


I basically replace the $('input[name='+$toCheck.attr('name')+']')
with
$(document.getElementsByName($toCheck.attr('name')))

wich is the same thing. And it's working now But i do not know
about compatibilities of getElementsByName
Works in FF 3 and IE 7 not sure about all other safari 

George.


On Nov 13, 6:12 pm, Ahhk [EMAIL PROTECTED] wrote:
 Wow, ok...thanks!

 I didnt think it was a jQuery issue and am surprised that jQuery, with as
 robust and fantastic as it is, wouldn't support array names for form
 elements.

 That seems like a major oversight to me :/

 But, maybe I'm one of only a few people who actually use array names/IDs.
 hr.

 It's SO much easier processing the data that way (numerically) instead of
 having to concatenate var names.





 George-147 wrote:

  I am with you now
  the problem is that you have weird name, with '[]' in it.

  this line
  $('input[name='+$toCheck.attr('name')+']')
  fails and returns empty collection.

  The problem is described here
 http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_...

  Unfortunatelly i failed to make it work with the solution there i am
  afraid that to many [] in the selector confusing JQuery. In their
  example they did it with the id so there were no additional [ ]
  brackets.
  $('input[name=q\\[1\\]]') returns me empty collection as well..

  but you might try to ask this group more specific question on how to
  make JQuery selectors work with the name like that q[1]

  George.

  Ahhk wrote:
  Thanks, but I didnt say I didnt want them to have the same name, I said
  that
  the script didnt work when the names were arrays.

  When the radio button groups have an name with an array, the script
  breaks
  and you can select/deselect multiple radio buttons within the group.

  Here's an example:

  label for=q1-11/labelinput type=radio name=q[1] value=1
  id=q1-1 /
  label for=q1-22/labelinput type=radio name=q[1] value=2
  id=q1-2 /
  label for=q1-33/labelinput type=radio name=q[1] value=3
  id=q1-3 /
  label for=q1-44/labelinput type=radio name=q[1] value=4
  id=q1-4 /

  label for=q2-11/labelinput type=radio name=q[2] value=1
  id=q2-1 /
  label for=q2-22/labelinput type=radio name=q[2] value=2
  id=q2-2 /
  label for=q2-33/labelinput type=radio name=q[2] value=3
  id=q2-3 /
  label for=q2-44/labelinput type=radio name=q[2] value=4
  id=q2-4 /

  label for=q3-11/labelinput type=radio name=q3 value=1
  id=q3-1
  /
  label for=q3-22/labelinput type=radio name=q3 value=2
  id=q3-2
  /
  label for=q3-33/labelinput type=radio name=q3 value=3
  id=q3-3
  /
  label for=q3-44/labelinput type=radio name=q3 value=4
  id=q3-4
  /

  label for=q4-11/labelinput type=radio name=q4 value=1
  id=q4-1
  /
  label for=q4-22/labelinput type=radio name=q4 value=2
  id=q4-2
  /
  label for=q4-33/labelinput type=radio name=q4 value=3
  id=q4-3
  /
  label for=q4-44/labelinput type=radio name=q4 value=4
  id=q4-4
  /

  The first two groups DONT work right, but the last two groups DO work.

  array name: q[4] vs non-array name: q4

  With the first two groups, I can select all or some of the radio buttons
  in
  the group. This appears to be purely a cosmetic/UI issue since only the
  value of the last one selected in the group gets submitted in the post
  (as
  it should).

  Something in the script doesnt support the array names.

  George-147 wrote:

   Sorry instead of Why do you want to give them the same name?

   I meant to say Why do you not want to give them the same name?

   George.

   On Nov 13, 3:06 pm, George [EMAIL PROTECTED] wrote:
   The problem that regular radio buttons are working only when they have
   the same name.
   No wonder prettty ones not working too... :)

   Why do you want to give them the same name?
   You can use different ids if you want. Something like this

   input type=rario name=group1 id=group1_1
   input type=rario name=group1 id=group1_2
   input type=rario name=group1 id=group1_3

   George.

   On Nov 12, 2:05 pm, Ahhk [EMAIL PROTECTED] wrote:

Anyone know how to fix this?

--
View this message in

  context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n...
Sent from the jQuery General Discussion mailing list archive at
   Nabble.com.- Hide quoted text -

   - Show quoted text -

  --
  View this message in context:
 http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in 
 context:http://www.nabble.com/PrettyCheckboxes

[jQuery] Re: working with checkboxes

2008-11-12 Thread George

Thanks,
But I think that
if (document.getElementById('test').checked ) {}
would be better...performance wise and readability is better

Is there problem with this approach?

PS: Is there shorter syntaxes for document.getElementById('test')?

Thanks
George.


On Nov 12, 1:25 pm, ripple [EMAIL PROTECTED] wrote:
 try:
  
 if ($(#test).is(:checked)) {}
  
  

 --- On Wed, 11/12/08, George [EMAIL PROTECTED] wrote:

 From: George [EMAIL PROTECTED]
 Subject: [jQuery] working with checkboxes
 To: jQuery (English) jquery-en@googlegroups.com
 Date: Wednesday, November 12, 2008, 1:11 PM

 I have a checkbox
 input type=checkbox id=test

 the $('#test').checked always returns undefined. No matter if checkbox
 checked or not...
 Is it how it's supposed to be?

 I thought that $('#test') will return me the object wrapped so i have
 original methods/properties as well as new one that came from JQuery.
 Am i mistaken?

 Thanks
 George.


[jQuery] Re: Select a tricky image with jQuery.

2008-11-12 Thread George

You can do
$('.imagefield:eq(0)') to select first image out of all 'imagefield'

George

On Nov 12, 4:33 pm, yo2lux [EMAIL PROTECTED] wrote:
 I have some image on webpage:

 img class=imagefield height=310 width=310 title= alt= src=/
 sites/default/files/first.gif/

 img class=imagefield height=310 width=310 title= alt= src=/
 sites/default/files/second.gif/

 img class=imagefield height=310 width=310 title= alt= src=/
 sites/default/files/third.gif/

 I need to set an event listener only on the first image.
 - I think, $('.imagefield') is not a good solution, because set the
 event listener on all image.

 Is possible to set the event listener using the image name ? For
 example: first.gif ?

 Sorry I have a complicated situation, the html editing is not allowed
 at all. Somehow I need to select the first image with jquery.

 Thanks!


[jQuery] Re: TableSorter not correctly sorting GridViews

2008-11-12 Thread George

Most likely the TableSorter could not detect the datatype correctly
and sorts it as if it were text.
Then you get that 70  100

Probably you have some HTML tags in the cell so TableSorter thinks the
content is text.

Checkout their examples on how to sort when HTML tags are present.

George.

On Nov 12, 11:59 am, Damien [EMAIL PROTECTED] wrote:
 Hello,

 I have a GridView, and applied to this GridView is the TableSorter
 jQuery Plug-in. As mentions it does not seem to be sorting correctly!
 Especially in the case of number where it sometimes using the first
 number to sort. Thus 70 is considered higher than 100!

 I am not sure what's causing this so any ideas would be helpful :).

 Some elements of the set up:

 The GridView's data is done programatically in code-behind
 Tablesorter is across 3 gridviews using a css selector for each. But I
 tried applying it to one table only and the bug still occurred.

 Thanks


[jQuery] Re: highlighted current link on accordian menu

2008-11-12 Thread George

Here is just an idea.

you can get current url from windows.location then run a JQuery and
find A tag with href atribute equal to the current url and set it's
class to something with color pink for example :)

Sounds like 2-3 lines of code Of course query parameters (like ? )
might complicate this task, but should not be hard to strip them out.

George.

On Nov 12, 9:17 pm, Low Kian Seong [EMAIL PROTECTED] wrote:
 Can someone show me how to highlight the accordion menu entry based on
 the current page that we are in ? As in sort of like an accordion that
 knows it's current page?


[jQuery] Am I using 'this' too often?

2008-11-10 Thread George

Being newbie in JavaScript I am trying to code my own helper object
that does pagination.
So here is a snippet of my code.

MyData.prototype = {
 blablabla...
   PageUp: function() {
this.iFrom += this.pageSize;
this.CheckPageIndex();
},


CheckPageIndex: function() {
if( this.iFrom = this.data.length )
this.iFrom = Math.floor((this.data.length - 1)/
this.pageSize) * this.pageSize;


if( this.iFrom  0 )
this.iFrom = 0;
}



}


Why do I need to call CheckPageIndex using this.CheckPageIndex when
called from PageUp? It's in the same object...

Without 'this' I get an error 'CheckPageIndex is undefined'. Coming
from object oriented languages like C++ I have a trouble
understanding
it.
Or am I doing it wrong and there is a way not to specify 'this' to
many times?

Thanks
George


[jQuery] Re: Am I using 'this' too often?

2008-11-10 Thread George

I had looked there probably 10 times :)
Are you implying that I need to convert my code to being Plug-In?
Other than that I do not see how this page 
http://docs.jquery.com/Plugins/Authoring
answers my question...
Sorry, but please spell it out for me.

The Plug-In would be the next step for me.. But as of now I am trying
to nail down the use of 'this' in JavaScript as it's a bit different
from what I am used to.


George.

On Nov 10, 11:43 am, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 you may want to have a look herehttp://docs.jquery.com/Plugins/Authoring



 On Mon, Nov 10, 2008 at 5:20 PM, George [EMAIL PROTECTED] wrote:

  Being newbie in JavaScript I am trying to code my own helper object
  that does pagination.
  So here is a snippet of my code.

  MyData.prototype = {
   blablabla...
    PageUp: function() {
         this.iFrom += this.pageSize;
         this.CheckPageIndex();
     },

     CheckPageIndex: function() {
         if( this.iFrom = this.data.length )
             this.iFrom = Math.floor((this.data.length - 1)/
  this.pageSize) * this.pageSize;

         if( this.iFrom  0 )
             this.iFrom = 0;
     }

  }

  Why do I need to call CheckPageIndex using this.CheckPageIndex when
  called from PageUp? It's in the same object...

  Without 'this' I get an error 'CheckPageIndex is undefined'. Coming
  from object oriented languages like C++ I have a trouble
  understanding
  it.
  Or am I doing it wrong and there is a way not to specify 'this' to
  many times?

  Thanks
  George- Hide quoted text -

 - Show quoted text -


[jQuery] Re: Am I using 'this' too often?

2008-11-10 Thread George

I see your point...
I had discovered recently the lack of JavaScript knowledge. And since
I mostly doing web development I realized that I am missing out a lot.

Unfortunately the object oriented approach JavaScript using is
different from  other object oriented languages I know (C++, C#, Java)
So I am trying to get up to speed with JavaScript and making up my own
problems/tasks. Like I am learning how 'this' works with JavaScript...

So the code I wrote is not promoted by another library :) It's
promoted by my background in C++ and C# mostly :)
So I chose JQuery as a library to use but before I can freely start
using it I want to understand how things work.
Cause as of right now if you tell me to write JQuery from scratch I
will not be ably even to start :)
And even having full source available does not help much since I often
do not understand what is going on




Thanks
George.



On Nov 10, 12:50 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 Well, using the pattern for plugin creation will make your life easier, and
 this will make more sense.
 Reading your code, it feels like you are using the structuration promoted by
 another library



 On Mon, Nov 10, 2008 at 6:29 PM, George [EMAIL PROTECTED] wrote:

  I had looked there probably 10 times :)
  Are you implying that I need to convert my code to being Plug-In?
  Other than that I do not see how this page
 http://docs.jquery.com/Plugins/Authoring
  answers my question...
  Sorry, but please spell it out for me.

  The Plug-In would be the next step for me.. But as of now I am trying
  to nail down the use of 'this' in JavaScript as it's a bit different
  from what I am used to.

  George.

  On Nov 10, 11:43 am, Olivier Percebois-Garve [EMAIL PROTECTED]
  wrote:
   you may want to have a look herehttp://docs.jquery.com/Plugins/Authoring

   On Mon, Nov 10, 2008 at 5:20 PM, George [EMAIL PROTECTED] wrote:

Being newbie in JavaScript I am trying to code my own helper object
that does pagination.
So here is a snippet of my code.

MyData.prototype = {
 blablabla...
  PageUp: function() {
       this.iFrom += this.pageSize;
       this.CheckPageIndex();
   },

   CheckPageIndex: function() {
       if( this.iFrom = this.data.length )
           this.iFrom = Math.floor((this.data.length - 1)/
this.pageSize) * this.pageSize;

       if( this.iFrom  0 )
           this.iFrom = 0;
   }

}

Why do I need to call CheckPageIndex using this.CheckPageIndex when
called from PageUp? It's in the same object...

Without 'this' I get an error 'CheckPageIndex is undefined'. Coming
from object oriented languages like C++ I have a trouble
understanding
it.
Or am I doing it wrong and there is a way not to specify 'this' to
many times?

Thanks
George- Hide quoted text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -


[jQuery] Re: Am I using 'this' too often?

2008-11-10 Thread George

Thanks for the link http://docs.jquery.com/UI/Developer_Guide
You are absolutely right about understanding.

Our professor of math was saying First you have to use it, then you
will understand it.
I  found it to be very true.

I had been using JQuery for some time... It's just I am working on a
new project which requires the tablesorter plug-in functionality
married with AJAX.
Unfortunately I were not able to use tablesorter as is. Since data
comes from AJAX and tablesorter plug in does not allow me reload data
into grid easily. I spent some time with it trying to fit it in but
finally gave up and decided that it's time to write my own thing.

And that is how I realized that I know too little about modern
JavaScript language. I used to think that I know it pretty well when
in reality all I could do is to use alert and setInteval functions :)

George.




On Nov 10, 3:11 pm, Balazs Endresz [EMAIL PROTECTED] wrote:
 The thing with the other libraries is that jQuery mainly promotes
 writing a simple functional plugin, beacause in many cases object-
 oriented code is really not necessary. Of course in other cases it is,
 like when building a widget:http://docs.jquery.com/UI/Developer_Guide

 So I think if you want to write your application that doesn't need to
 be a jquery plugin, just use a general design pattern if that's more
 suitable. And most likely it will be convenient to write some custom
 jQuery plugins too, but that is really 
 simple:http://docs.jquery.com/Plugins/Authoring

 Using jQuery should be very easy, and you don't have to understand it
 in depth first, just play with the examples and see what happens.
 Understanding how to construct a javascript application is quite a
 different thing. Of course they meet some time in the future, e.g. if
 you're building a complex jQuery plugin, but this shouldn't be the
 point to start I think, just start learning these separately!

 Cheers,
 Balazs

 On Nov 10, 7:24 pm, George [EMAIL PROTECTED] wrote:



  I see your point...
  I had discovered recently the lack of JavaScript knowledge. And since
  I mostly doing web development I realized that I am missing out a lot.

  Unfortunately the object oriented approach JavaScript using is
  different from  other object oriented languages I know (C++, C#, Java)
  So I am trying to get up to speed with JavaScript and making up my own
  problems/tasks. Like I am learning how 'this' works with JavaScript...

  So the code I wrote is not promoted by another library :) It's
  promoted by my background in C++ and C# mostly :)
  So I chose JQuery as a library to use but before I can freely start
  using it I want to understand how things work.
  Cause as of right now if you tell me to write JQuery from scratch I
  will not be ably even to start :)
  And even having full source available does not help much since I often
  do not understand what is going on

  Thanks
  George.

  On Nov 10, 12:50 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
  wrote:

   Well, using the pattern for plugin creation will make your life easier, 
   and
   this will make more sense.
   Reading your code, it feels like you are using the structuration promoted 
   by
   another library

   On Mon, Nov 10, 2008 at 6:29 PM, George [EMAIL PROTECTED] wrote:

I had looked there probably 10 times :)
Are you implying that I need to convert my code to being Plug-In?
Other than that I do not see how this page
   http://docs.jquery.com/Plugins/Authoring
answers my question...
Sorry, but please spell it out for me.

The Plug-In would be the next step for me.. But as of now I am trying
to nail down the use of 'this' in JavaScript as it's a bit different
from what I am used to.

George.

On Nov 10, 11:43 am, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 you may want to have a look 
 herehttp://docs.jquery.com/Plugins/Authoring

 On Mon, Nov 10, 2008 at 5:20 PM, George [EMAIL PROTECTED] wrote:

  Being newbie in JavaScript I am trying to code my own helper object
  that does pagination.
  So here is a snippet of my code.

  MyData.prototype = {
   blablabla...
    PageUp: function() {
         this.iFrom += this.pageSize;
         this.CheckPageIndex();
     },

     CheckPageIndex: function() {
         if( this.iFrom = this.data.length )
             this.iFrom = Math.floor((this.data.length - 1)/
  this.pageSize) * this.pageSize;

         if( this.iFrom  0 )
             this.iFrom = 0;
     }

  }

  Why do I need to call CheckPageIndex using this.CheckPageIndex when
  called from PageUp? It's in the same object...

  Without 'this' I get an error 'CheckPageIndex is undefined'. Coming
  from object oriented languages like C++ I have a trouble
  understanding
  it.
  Or am I doing it wrong and there is a way not to specify 'this' to
  many times?

  Thanks
  George- Hide quoted

[jQuery] Re: Javascript question.

2008-11-09 Thread George

I guess I figured it out myself :)

function GetD(tb)
{
$this = document.getElementById(tb);
var obj = new MyData($this);
return obj;
}


function MyData(tb)
{
this.init(tb);
}

MyData.prototype = {
init : function (tb){
this.div = tb;
this.refresh();
},

refresh: function(){
var d = this;
$.ajax({
type: 'POST',
url: 'Default.aspx/Fetch',
data: {},
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(result) {d.UpdateData(result);}
});
},

UpdateData: function (result) {
var obj = this.div;
obj.innerHTML = result.d;

}
}


Thanks
George



On Nov 9, 11:58 pm, George [EMAIL PROTECTED] wrote:
 I am writing an object that gets data using AJAX and shows it in DIV
 Also this object must provide refresh method so data can be easily
 refreshed.

 Here is my implementation

 function GetD(tb)
 {
     $this = document.getElementById(tb);
     var obj = new MyData($this);
     return obj;

 }

 function MyData(tb)
 {
     this.init(tb);

 }

 MyData.prototype = {
     init : function (tb){
         this.div = tb;
         this.refresh();
     },

     refresh: function(){
         var tb = this.div;
         $.ajax({
             type: 'POST',
             url: 'Default.aspx/Fetch',
             data: {},
             contentType: 'application/json; charset=utf-8',
             dataType: 'json',
             success: function(result) {Populate( tb, result);}
         });
     }

 }

 function Populate (tb, result)
 {
     tb.innerHTML = result.d;

 }

 and the actual use:

 div id=test/div

 script
 var o = GetD('test');
 ...blablalba.
 o.refresh();
 /script

 Question: Is is possible to move Populate into MyData object?

 PS: I realize that the whole thing does not make much sense but since
 I have trouble fully understand how 'this' and objects work in
 JavaScript I am doing this as an exercise.

 Thanks
 George.


[jQuery] Javascript question.

2008-11-09 Thread George

I am writing an object that gets data using AJAX and shows it in DIV
Also this object must provide refresh method so data can be easily
refreshed.

Here is my implementation


function GetD(tb)
{
$this = document.getElementById(tb);
var obj = new MyData($this);
return obj;
}


function MyData(tb)
{
this.init(tb);
}

MyData.prototype = {
init : function (tb){
this.div = tb;
this.refresh();
},

refresh: function(){
var tb = this.div;
$.ajax({
type: 'POST',
url: 'Default.aspx/Fetch',
data: {},
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(result) {Populate( tb, result);}
});
}
}

function Populate (tb, result)
{
tb.innerHTML = result.d;
}


and the actual use:

div id=test/div

script
var o = GetD('test');
...blablalba.
o.refresh();
/script

Question: Is is possible to move Populate into MyData object?

PS: I realize that the whole thing does not make much sense but since
I have trouble fully understand how 'this' and objects work in
JavaScript I am doing this as an exercise.


Thanks
George.


[jQuery] Plugin/Object

2008-11-08 Thread George

I am learning JQuery and trying to write my own Plug-in.
I have a 'Blinking' plug in. It just makes text blink.

Now I want to be able to stop the blinking (for what ever reason) at
the same time I want to keep the Plug-In styling.

So to make item blink I do

$('#myitem').blink();

Now to stop it I want to be able do something like this

$('#myitem').stopBlinking();

I am not sure how to go about it I've learned the 'event'
technique where I can bind to 'StopBlink' event and then do $
('#myitem').trigger('StopBlink');

But I would like to keep Plug-in type of call so I will be able to do
it like $('#myitem').stopBlinking();


-Here is my blinking plug in
(function($)
{
$.fn.blink = function(options)
{
var opts = $.extend({}, $.fn.blink.defaults, options);
var timer;
return this.each(function()
{
var $this = $(this);
var currentClass = opts.class1;
timer = setInterval(function()
{DoTheBlink($this,opts,currentClass)}, 1000);
});
}

function DoTheBlink($el,opts,currentClass)
{

var newClass = (currentClass == opts.class1) ? opts.class1 :
opts.class2;
$el.toggleClass(newClass);
};

$.fn.blink.defaults = {
class1: 'red',
class2: 'blue'
};

})(jQuery);


How do i add stopBlinking?

Thanks
George.


[jQuery] My first plug in. Need comments.

2008-11-06 Thread George

Guys, I am learning JQuery (and JavaScript) in general.
So I decided to write my first 'Blink' plug in.
It works but can you please take a look an tell me if something is
considered bad practice or can be done better.



(function($) {
$.fn.blink = function(options) {
var opts = $.extend({}, $.fn.blink.defaults, options);
return this.each(function() {
var $this = $(this);
var currentColor = opts.color1;

$this.css({backgroundColor: currentColor});
window.setInterval(function (){DoTheBlink();},
1000);
function DoTheBlink()
{
if (currentColor == opts.color1)
currentColor = opts.color2;
else
currentColor = opts.color1;
$this.css({ backgroundColor: currentColor });
}
});
};


$.fn.blink.defaults = {
color1: 'red',
color2: 'blue'
};
})(jQuery);


--USE-
div id=t1hahaha/div
div id=t2hahaha/div
div id=t3hahaha/div
script
$(document).ready(function() {

$('#t1').blink({ color1: 'red', color2:'blue' });
$('#t2').blink({ color1: 'yellow', color2:'black' });
$('#t3').blink({ color1: 'red', color2:'green' });
});

Thanks
George.


[jQuery] Re: My first plug in. Need comments.

2008-11-06 Thread George

Thanks,
I see your point..

George.

On Nov 6, 7:28 am, Alexandre Plennevaux [EMAIL PROTECTED]
wrote:
 Hi Georges !

 excellent way to learn.

 personally, i would use toggleClass()
 (http://docs.jquery.com/Attributes/toggleClass#class) and have the
 color set in the CSS file. As a rule, try always to use each
 technology for what it was meant:

 html  data
 css  styling
 javascript  behaviour

 so it would be:http://jsbin.com/osaxa



 On Thu, Nov 6, 2008 at 6:46 AM, George [EMAIL PROTECTED] wrote:

  Guys, I am learning JQuery (and JavaScript) in general.
  So I decided to write my first 'Blink' plug in.
  It works but can you please take a look an tell me if something is
  considered bad practice or can be done better.

  (function($) {
     $.fn.blink = function(options) {
         var opts = $.extend({}, $.fn.blink.defaults, options);
         return this.each(function() {
             var $this = $(this);
             var currentColor = opts.color1;

             $this.css({backgroundColor: currentColor});
             window.setInterval(function (){DoTheBlink();},
  1000);
             function DoTheBlink()
             {
                 if (currentColor == opts.color1)
                     currentColor = opts.color2;
                 else
                     currentColor = opts.color1;
                 $this.css({ backgroundColor: currentColor });
             }
         });
     };

     $.fn.blink.defaults = {
         color1: 'red',
         color2: 'blue'
     };
  })(jQuery);

  --USE-
  div id=t1hahaha/div
  div id=t2hahaha/div
  div id=t3hahaha/div
  script
     $(document).ready(function() {

     $('#t1').blink({ color1: 'red', color2:'blue' });
     $('#t2').blink({ color1: 'yellow', color2:'black' });
     $('#t3').blink({ color1: 'red', color2:'green' });
  });

  Thanks
  George.- Hide quoted text -

 - Show quoted text -


[jQuery] Re: Executing Scripts returned by AJAX Request

2008-11-06 Thread George

My guess you could use Eval statement...

George.

On Nov 6, 10:07 am, briandichiara [EMAIL PROTECTED] wrote:
 Hi,

 I would like my AJAX Request to function like this:

 if empty, all good, proceed.
 if scripts, not good, execute the script.
 if no scripts, but something in response, alert the text (some kind of
 error).

 Reason I want this is when the user tries to execute an action that
 requires them to be logged in and they are not or their session has
 timed out, I would like to output script to the AJAX Request page so
 the jQuery function can execute it and redirect the user to the login
 form. Is there something built in to handle scripts received by an
 AJAX Request?

 Thanks.


[jQuery] Understanding JQuery/Javascript.

2008-11-06 Thread George

Hi guys, I need some help with understanding JQuery/Javacript.
I am far away form being a Javascript guru so I am not sure I
understand why something done this (or other) way.

I am looking at tablesorterPager plug-in and it's written following
way

(function($) {
$.extend({
tablesorterPager: new function() {
...blablabla..
}
});
// extend plugin scope
$.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});

})(jQuery);


If I were to write this plug in I would do it like this
(function($)
{
$.fn.tablesorterPager = function()
{
  .blabblabla
}
})(jQuery);


Questions:
Any advantages of writing it the way it's written?
Basically what is this $.extend({}) for? What does it achive.

Thanks
George.


[jQuery] Re: ANNOUNCE: ui.timepickr.js plugin

2008-10-09 Thread George Adamson

Good work, and it has a nice feel to it. I look forward to seeing the
24h and keyboard access todo's sorted!

I did something like this a while back for selecting year, month and
day. (Yours looks better though!)
Because the row of 31 days was so long I arranged them in two rows of
15.

I dare say you could enhance yours to pick dates instead (or as
well?!)

When you tackle the 24h layout you could offer the option of 2 rows of
12 to save horizontal space. some people will prefer it in some
circumstances.

Cheers,
George Adamson


[jQuery] Re: Jquery and ASP.NET

2008-10-06 Thread George Adamson

To get around the server-side-id vs client-side-id differences you can
often use id selectors like this $(DIV[id$=myServerSideID]) but
there is always the possibility of confusion between elements whose
IDs end with the same pattern of letters.

For an internal project we've used a couple of quick and dirty custom
selectors called :aspid() and :aspname()   The :aspid() selector
suffers from the same issues as the $id=... solution above.
The :aspname() selector will not get confused between elements but it
only works on form elements because they have a name attribute.

They rely on the way asp.net build client IDs and Names that end with
the server-side id...
I would not recommend widespread use of these selectors because they
are so asp-specific but they can be helpful none the less.

Cheer. I hope this helps a wee bit.

jQuery.extend(jQuery.expr[':'], {

/**
 * Custom selector for matching elements by their server-side ID
(using their client-side IDs generated by ASP.Net)
 * They may return multiple elements when more than one client-side
id ends with the same id string.
 *
 * (Note: The :aspid() selector matches on the element id.
The :aspname() selector matches on the element name (so it only works
on form elements that support the name attribute). The latter is more
accurate because it can rely on the $ separator in the name
attribute to correctly locate the start of the id in the string)
 *
 * @param String id The ID to search for. This is the id you used in
the ASP server-side code.
 *
 * @example $(INPUT:aspid(buttonEdit))
 * @desc Find the input element who's server-side id is buttonEdit.
(The client-side id will be something like
ctl00_MainContent_buttonEdit)
 *
 * @name :aspid, :aspname
 * @type jQuery object
 *
 * @cat jQuery/Custom selector
 * @author George Adamson
 */
aspid : function(a,i,m){ var id=a.getAttribute(id);   
return id
 m[3]  id.substr(id.length - m[3].length - 1) == _+m[3]; },
aspname   : function(a,i,m){ var id=a.getAttribute(name); 
return id
 m[3]  id.substr(id.length - m[3].length - 1) == $+m[3]; }
});


[jQuery] Tablesorter - How to detect which header cell was clicked? (in sortStart/sortEnd callbacks)

2008-09-25 Thread George Adamson

Hi there,

When using the excellent tablesorter plugin, I need to intercept the
click event to remove irrelevent rows from the table before the
columns are sorted (and put some back after sorting).

The sortStart/sortEnd callbacks are called at the right time but how
do I find out which cell (column header) was clicked?

(More info: The irrelevent rows I mentioned are actually headings
for groups of associated rows. I need to remove those headings just
before a sort starts, then put them back afterwards (using a sortEnd
callback).  The new group headings are be based on the sort column and
generated dynamically. This tableGrouper code will eventually become a
plugin to work with the table sorter)

Many thanks,

George Adamson


[jQuery] What is the opposite of the jQuery.param() method? (to deserialise an object)

2008-07-01 Thread George Adamson

Hi all,

If we use the $.param(myobject) method to serialise an object, how can
we deserialise that string back to an object?

Maybe that function exists somewhere and I'm having a mental block.
Please help!

In the absence of such a method I would do something like this:

jQuery.extend({
// The opposiite of jQuery's native $.param() method. Deserialises a
param string to an object:
// Note: TODO: Allow for multiple params with same name (to become an
array attribute).
unparam : function(params){
var objResult = {};
$.each(params.split(), function(){ var prm=this.split(=);
objResult[prm[0]] = prm[1]; });
return objResult;
}
});


[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available

2008-06-05 Thread George Adamson

Ever more impressive. Well done you lot, you make us proud!

George


[jQuery] Re: Pairing Toggle/Expand Behavior with Particular Element Pairs

2008-04-15 Thread George

It looks like what you're doing is setting a variable for all of the
comments when the page is loaded, and reusing that variable when you
want to show the Flag comment section.

Instead, you'd want to only handle the comment that the user clicked
on by using the parent() function available in JQuery.

Something like the following (untested code):

$(document).ready(function(){
// --- Toggle Flag Comments On/Off --- //
  $(.comment .flag-comment).hide();
// add in toggle button
  $('.comment-header').append('a class=button button-flag flag-
toggle href=spanFlag This Comment/span/a');
// toggles the flag form
  $('.flag-toggle').click(function(){
// slowly expand/collapse
$(this).parent().parent().children('.flag-
comment').slideToggle('slow');
// toggles class on toggle button
$(this).toggleClass('flag-toggle-opened');
// disables the default html behavior of the a element
return false;
  });
});

 - George

On Apr 14, 5:43 pm, Brian Talbot [EMAIL PROTECTED] wrote:
 Hi All,

 I was wondering if anyone had any insight into an issue I'm having
 when using JQuery to show/hide a series of elements on a page. I
 currently have a set of comments (to be placed in a larger page) and
 along with each comment a form is needed to allow users to flag an
 individual comment.

 I've tried to create this page with accessibility in mind so there is
 one unique form (with its own ID) for each comment  (also with its own
 ID). You can view a sample page without any styling here 
 -http://brian-talbot.com/inventingroom/flagcomments/

 The interaction I'd like to have is when a user clicks on the Flag
 This Comment link (that I am inserting into each comment's div
 using JQuery) The form for the specific comment the user wants to flag
 (hidden by default using JQuery) toggles its visibility to visible and
 allows the user to enter information.

 What I have now doesn't account for the specific comment a user
 selects and expands all of the comments instead :o( Also, I'd love to
 be able to do the following:

 1) Change the text of the Flag This Comment toggle link to display
 something else once the form is expanded for a particular comment -
 perhaps to something like Cancel Flagging This Comment.

 2) Dynamically add an href attribute to the Flag This Comment toggle
 link that provides an anchor link down to the corresponding flag form
 (i.e. a class=button button-flag flag-toggle href=#flag-
 comment001spanFlag This Comment/span/a

 If anyone has any ideas and wouldn't mind sharing, it would be much
 appreciated. Thanks!


[jQuery] Re: How to apply a Zebra Table Effect considering 3 rows instead 1

2008-04-09 Thread George

You could also try $(TR).filter(*:nth-child(6n+1), *:nth-child(6n
+2), *:nth-child(6n+3)).addClass(specialBackground)

Perhaps someone can offer a more concise alternative syntax to do
that?!

George

On Mar 25, 3:16 pm, Leandro Vieira Pinho [EMAIL PROTECTED]
wrote:
 Hi guys,
 I´m looking for a solution to apply a Zebra Table Effect considering 3
 rows a time instead 1.


[jQuery] Re: EqualTo but only if checkbox is checked

2008-03-03 Thread George

I may not be sure what you're wanting but something like this may
help:

...  $(#billingAddress).val() == $(#shippingAddress).val()  $
(#comparefields).is(:checked);

I presumed you are wanting to compare the billingAddress and
shippingAddress values.

George

On Mar 3, 4:13 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 How can I compare 2 text fields only if a certain checkbox is
 checked?  Can you do something like this?

 billingAddress: {
 required: true
 minlength: 5
 equalTo: #shippingAddress  function(element) {
 return jQuery(#comparefields).is(:checked);

 },


[jQuery] Site Blank in IE7

2008-02-24 Thread George

Hi, I'e just started using jquery and have to say I like it.  One big
problem though, my site (http://www.georgemauer.net) doesn't show up
when I try to go to it in internet explorer 7.  Nothing, its blank,
just shows up as the background color.  Strangely enough, all the html
in view source is still there.  The page works fine in firefox and
opera (not sure about safari, ie6).  But if I remove the reference to
the jquery library then it works in IE too (though obviousy without
the jquery functionality).
I assume this is something really simple, can one of you gurus take a
quick look and tell me what is going on?

Thanks a lot,
Toga



[jQuery] Re: fadeOut and IE6

2008-02-21 Thread George

Anyone?  Beuller?

bump

On Feb 18, 11:40 am, George [EMAIL PROTECTED] wrote:
 I'm currently building a widget which contains multiple deep dives
 into sections of a website in a limited amount of space and have run
 into an issue when using thefadeOutfunction with IE6.

 Per the requirements of this section, the client wants to have the
 currently selected item fade out and the new item's background fade in
 at the same time.  This is working great in Firefox, IE7 and Safari,
 but for whatever reason, thefadeOutfunction doesn't seem to fire
 correctly in IE6.  Has anyone run across this before?

 You can see a copy of the page at the address below.  Any help is much
 appreciated!

  - George

 http://216.120.230.80/~rieekan/homeActionTrayV1.html


[jQuery] fadeOut and IE6

2008-02-18 Thread George

I'm currently building a widget which contains multiple deep dives
into sections of a website in a limited amount of space and have run
into an issue when using the fadeOut function with IE6.

Per the requirements of this section, the client wants to have the
currently selected item fade out and the new item's background fade in
at the same time.  This is working great in Firefox, IE7 and Safari,
but for whatever reason, the fadeOut function doesn't seem to fire
correctly in IE6.  Has anyone run across this before?

You can see a copy of the page at the address below.  Any help is much
appreciated!

 - George

http://216.120.230.80/~rieekan/homeActionTrayV1.html


[jQuery] Re: slider bar in jQuery

2008-02-18 Thread George

There is slider functionality in the jQuery UI project ( http://ui.jquery.com
) which will do pretty much what you're looking for.

On Feb 18, 7:01 am, Ariel Flesler [EMAIL PROTECTED] wrote:
 The 2nd link is awesome! :)

 Ariel Flesler

 On Feb 17, 10:38 pm, alex [EMAIL PROTECTED] wrote:

  Hello,

  I am new to both jQuery and YUI.  While jQuery has an easy slideUp
  slideDown mehtods..YUI has an easy slider widget (http://
  developer.yahoo.com/yui/examples/slider/slider-simple.html).

  I am confused which one can achieve the similar feat for 
  me:http://demo.backbase.com/travel/

  In that demo if you move the price slider from left to right then the
  data on the right is shifted accordings.

  Can someone please give me a pointer on where to begin with this? for
  starters i dont even want to go back to the server..just want to
  achieve this with non-dynamic data.


[jQuery] Re: finding if element is focused

2008-02-18 Thread George

Yep do give it a go.  It's probably the :focus selector that you're
after.  I'm sorry to say that I've not yet tested it with v1.2.3 and I
fear it will probably break because of the changes to the way selector
expressions must be defined in the latest version (as functions
instead of eval text). Oh well, I dare say I'll fix it soon.

Cheers,

George


On Feb 18, 7:29 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
 this should help...

 http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

 --Karl
 _
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Feb 8, 2008, at 10:36 AM, Eridius wrote:



  i know i bind a function to the event focus of an element but is
  there a way
  i can see if a element is focused like?

  if(element.focus())
  {
 //true
  }
  else
  {
 //false
  }
  --
  View this message in 
  context:http://www.nabble.com/finding-if-element-is-focused-tp15357587s27240p...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.


[jQuery] Re: Change stylesheets if images are off

2008-02-16 Thread George

Interesting idea Cherry,

Have you noticed whether the imagefree.css starts to load anyway
before the href is changed to gotimages.css? (I'd expect the if-
statement to run before the load() callback function).  In IE you
could try the error event as the alternative condition. Can't remember
what the alternative would be in FF etc.  Also, to save on markup
could you use a closure for your imagecheck value instead of an
element? (eg: var imagecheck = false; at the start of your imagesOn
function)

Just some initial thoughts. Cheers,

George

On Feb 15, 11:55 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I finally finished it 

  // detect whether images are on
 // and change styles accordingly
 jQuery.imagesOn = function(){

  $('img src=' + '/images/bgimage.jpg' + '#' + Math.random() + '/' 
 ).load(function() {

   $('#noimages').attr(href, '/styles/gotimages.css');
   $('.imagecheck').html('On');
  });

  if ( $('.imagecheck').val() != 'On' ) {
   $('#noimages').attr(href, '/styles/imagefree.css');
  }

 }

 (hack:  there is a hidden paragraph to hold the 'variable')

 Cherryhttp://jquery.cherryaustin.com


[jQuery] Re: div select and change it's css

2008-02-16 Thread George

 jQuery being what it is, there's bound to be a way of doing
 this in one line, though :)

$(this).addClass(highlight).siblings().removeClass(highlight)

...that saves a document wide search for $(.section)

Geoge


[jQuery] FadeOut and IE 6

2008-02-15 Thread George

I'm attempting to write a new type of interactive widget and have run
into a problem.  This widget uses various backgrounds for the
different states within it and when a user changes from one state to
another, the requested interaction should be to fade out the existing
background while the new one fades in.

I've got this working great in Firefox, but, as always, IE is giving
me fits.  It seems to ignore the fadeOut function and just removes the
element altogether before fading in the new.  I'm sure there's
something I'm missing here, but I can't seem to find it (too close to
the project).  You can see a working example at the address below.

http://216.120.230.80/~rieekan/homeActionTrayV1.html

Any help is most appreciated!

 - George


[jQuery] Re: bug with animate and a duration of 0 milliseconds?

2008-02-12 Thread George


FWIW:   A while back I also found that the callback function is not
called after a zero-second show() or hide().
Dunno if that is still the case.  Just a heads up in case anyone else
experiences that.
George (in haste...)


[jQuery] Re: Is it possible jQuery do similar actions width $(this) such as selectors like $(DIV A)

2008-02-12 Thread George

Further to the other responses... You can squeeze out a slight
performance boost by using the child selector or children() method.
(Most noticable when find() is faced with searching a deep DOM, or
perhaps when this search is one of many in a loop.)

Eg: $(this).children(DT) or $(this).find(DT) or $(DT,this)
(Not tested in latest version of jQuery 1.2.3, though I presume it
still makes a difference)

George

On Jan 22, 3:51 pm, mtest [EMAIL PROTECTED] wrote:
 Firstly, sorry for my english, but it's very important to me know the
 answer :).

 For example there is such a code:
 dl
 dtMenu/dt
 ddSubMenu1/dd
 ddSubMenu2/dd
 ddSubMenu3/dd
 /dl

 i call function:
 $(dl).bind(mouseover, function(){

 I get the object DL, witch now may to call like this or $
 (this):

 How I can get now DT or DD usingthis   ?

 I know that can do like $(DL DT)  or$(DL DD)?

 But now in$(this)I have yet selected DL

 How can i use this with selectors??

 $(this DT)  - not right

 $(this DT) - not right

 $(this DT) - not right

 How

 Please help me :)


[jQuery] Re: localScroll Problem

2008-02-12 Thread George GSGD

It would certainly help track down the problem if you listed which
plugins you're using. Only thing I can see from what's been posted so
far is that you've got E.easing[...]. What're you using the E object
for? It's telling you it can't find the easing function in E.easing

On Feb 12, 12:49 pm, Sebastián V. Würtz [EMAIL PROTECTED]
wrote:
 Ariel Flesler escribió:

  Hi Sebastian, that seems to be ScrollTo, not LocalScroll.
  The error you get is quite common and is related (obviously) to
  easing.
  Is that your full code ? aren't you specifying an easing equation ?
  have you added the easing plugin ?

  Do you have a demo of it ? so I can check.
  Cheers

  Ariel Flesler

  On 12 feb, 09:58, Sebastián V. Würtz [EMAIL PROTECTED] wrote:

  im trying to use the localScroll pluginh in many ways :)
  but i receive this error when i click

  $(#comentar).click(function(){
  $.scrollTo( '-=900', 300 );
  return false;
  });

  E.easing[this.options.easing || (E.easing.swing ? swing : linear)]
  is not a function
  E.easing[this.options.easing || (E.easing.swing ? swing : linear)]
  is not a function
  E.easing[this.options.easing || (E.easing.swing ? swing : linear)]
  is not a function
  E.easing[this.options.easing || (E.easing.swing ? swing : linear)]
  is not a function

  (latest lib for all)

 im using a lot of jquery scripts in one new proyect, for now i cant
 upload all because have a big database, is a news system, btw im not
 using easing plugin, but i try with it and still the same, im so close
 to finish with it so i have many many questions :)

 thx for now


[jQuery] Re: jQuery UI Enchant Alpha Versions Released

2008-02-07 Thread George

Superb, well done team jQuery!

The UI stuff is looking smooth. I notice that there are even some
significant changes to the innerds of jQuery in v1.2.3.  (For instance
you've coded the :selectors using functions instead if strings. Has
that improved performance?)

George



On Feb 7, 4:02 pm, Rey Bango [EMAIL PROTECTED] wrote:
 The jQuery UI team announced today the release of alpha versions of
 jQuery UI 1.5a and jQuery Enchant 1.0a! The projects aim to address the
 need for a strong set of UI controls and effects to complement the
 jQuery JavaScript library.

  From Paul Bakaus, UI team lead:

 Hi everybody!

 I'm very happy to announce the first alpha release of both jQuery UI 1.5
 and jQuery Enchant 1.0 to all the adventurous guys out there. This is a
 huge update - the whole API has been standardized and updated, and many
 of the plugins have been completely rewritten. jQuery Enchant is the
 missing part of UI: A library completely devoted to rich effects. It
 already features all effects you know from scriptaculous/interface, as
 well as many more great additions: color animations, class animations
 and highly configurable effects.

 Be advised that while it's extremly hot (and fresh), this release is
 absolutely not stable - there is no documentation at this point, so you
 have to digg into the demos and code yourself if you want to check it
 out. It's really only a testing and try-out release. This will allow us
 to be able to get it out to you guys, then spend the next days on
 further bugfixing and improvements. It would be great if you could test
 and report whatever you think should work from looking at the code - it
 really helps us to get the beta ready, which is scheduled for February
 10th. The beta will come out with official release notes and an updated
 documentation.

 Since it's alpha, it's not only stablity missing - the following stuff
 is not included:

 - Draggable option wrapHelper
 - Almost everything of slider

 I will soon answer to this thread with uploaded demos that you can try
 out right away. Thanks a lot so far for everyone who helped in making
 this happen (more on that in the beta release!) Anyway, try it out for
 yourself!

 The code and demos for the two libraries can be found here:

 jQuery 
 UI:http://jqueryjs.googlecode.com/files/jquery.ui-1.5a.ziphttp://ui.jquery.com/1.5a/demos/

 jQuery 
 Enchant:http://jqueryjs.googlecode.com/files/jquery.enchant-1.0a.ziphttp://ui.jquery.com/enchant/1.0a/demos/

 It's important to note that both jQuery UI and Enchant require the newly
 jQuery v1.2.3 which was released last 
 night.http://code.jquery.com/jquery-1.2.3.jshttp://code.jquery.com/jquery-1.2.3.min.jshttp://code.jquery.com/jquery-1.2.3.pack.js


[jQuery] Re: :contains and case sensitive results

2008-02-06 Thread George


Hi Shogobunky,

The moreSelectors plugin adds a :Contains() selector which is case
insensitive (notice the upper case C).
(http://plugins.jquery.com/project/moreSelectors)

It is probably overkill to include an entire plugin for that one
feature however, so you could just include the one selector definition
in your code. Something like this...

  jQuery.extend(jQuery.expr[':'], {
Contains :
jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())=0
  });

George


On Feb 5, 7:10 pm, Shogobunky [EMAIL PROTECTED] wrote:
 Is there a workaround to making the :contains filter case
 insensitive? Thank you.


[jQuery] Re: JQuery takes 80% of my core2Duo proc on DOM element inserts

2008-02-05 Thread George GSGD

I think it's generally proven that inserting dom objects is much
slower than innerHTML, for the kind of inserting you're trying, that
might be worth investigating...

On Feb 4, 1:57 pm, Ashish [EMAIL PROTECTED] wrote:
 Hi ,

 I am very new to jquery. I am using jquery 1.2.2 . I use jquery
 tablesorter to insert around 400 rows to a table. The data is
 collected using an Ajax call.

 When new rows are inserted to the table the CPU utilization shoots up
 to 80%. All browsers freeze until the table is populated :(

 I tried to insert 400 divs to a single div and faced the same problem.
 This rules out a problem with tablesorter.

 Does jquery attach a lot of handlers to dom events that make appends
 very slow ?

 Any suggestions would be much appreciated.

 Thanks and regards,
  - Ashish


[jQuery] Re: dynamic classes

2008-02-05 Thread George


Can you use the :nth() selector ?

Are the buttons next to the list items? If so could you just find the
form that is next to the button?  Eg: $(this).next(FORM)



On Feb 5, 2:12 am, jg [EMAIL PROTECTED] wrote:
 Hope that makes sense. Any thoughts?


[jQuery] Re: Selecting listboxes that are in a table

2008-01-25 Thread George

Hi there,

The  selector only matches an immediate child so in your example,
the only children of #ColumnEdit are tr elements, not select
elements.

That said, I'm surprised #ColumnEdit  tr  td  select did not
return any matches.  Could it be because you've used a self-closing
tag instead of select.../select ?

If you simply leave a space between #ColumnEdit and select then jQuery
will delve deeper for you and find what you want.

George



On Jan 24, 9:49 pm, MorningZ [EMAIL PROTECTED] wrote:
 Shouldn't
           $(#ColumnEdit  select)
 Provide me a jQuery array of those select boxes?


[jQuery] Re: Manipulate Element After Being Added to DOM

2008-01-21 Thread George

Don't forget you could also just bind a click event to a parent
object.
That way any click in a child element, old or new, will bubble up and
trigger the click event.  In the event handler, just inspect
event.target to see which child was clicked.

George


[jQuery] Re: script works in firefox bu not in IE or Safari why???

2008-01-17 Thread George

There may be some confusion over the use of commas in your jQuery
selectors. You can use commas *in* the selector string when you need
more than one selector but you cannot put commes between jQuery calls
(that would not be valid javascript).

It should work if you remove the two occurrences of $
('input[name]'),

If you do need to test for the presence of the name attribute then you
could try

$('input[name][id$=div]')   instead

Cheers,
George

PS: You can also reduce  $(document).ready(function(){...  to
just$(function(){...

On Jan 16, 8:52 pm, hollow [EMAIL PROTECTED] wrote:
 The script presented  here works like a charm in firefox 2.
 But it doens't do anything on IE or safari.
 What it is supposed to do is take the name of a input field then the
 id if it is text, div.
 then change the color depending on the id of the input field
 if it is text then change the text color.
 if it is div change the bgcolor of the div.
 $(document).ready(function () {
                                 $('input[name]'),$('input[id
 $=div]').change(function(){
                                         $
 ('#'+this.name).css('background-color', this.value);
                                 });
                                 $('input[name]'),$('input[id
 $=text]').change(function(){
                                         $('#'+this.name).css('color',
 this.value);
                                 });
                 });
 For some reason it doesn't make the changes in corresponding divs in
 IE or safari.
 Help would be much appreciated.
 Hollow


[jQuery] Re: Look mum, TABS layout only with CSS !!

2008-01-17 Thread George

FWIW, I prefer the dl approach where
- tab labels are made from dt's and
- tab contents are made from dd's

George

On Jan 15, 5:31 pm, Enrique Meléndez Estrada [EMAIL PROTECTED] wrote:
 Looking at official TABs plugin, I realized that the HTML structure is
 not very natural. It uses a list (UL) of tab headers follow by tab
 bodies (DIV). Normally, what you get from your favorite CMS is something
 more like : a header (div, h,...), its body (div), another header (div,
 h, ...), its body (div), etc...

 My challenge was, using this last  natural HTML structure, try to
 layout it in a TABs way. I think I've got it:

 http://www.ita.es/jquery/tabs_only_css.htm

 ,  where practically  I have used the same HTML for all 8 TABS
 combinations. The result is compatible with IE6, IE7, FF and Opera. But
 there are some limitations to take into account when implementing as a
 Jquery plugin (as I wish, ;-):

     *
       Only versions topRight, topLeft, leftTop and rightTop are100%
       automatic (CSS doesn't depend on TABs number, height and width).
     *
       Versions leftBottom, rightBottom, bottomLeft and bottomRight
       depends on  TABS number, and the height and/or width applied (This
       is very jquerysh-able)
     *
       I used QUIRK format (see doctype in HTML) for IE: the same CSS for
       IE6 and IE7, but in STRICT format it would only work in IE7 (I
       don't control  IE6 by now)
     * Body TABs height is fixed (100px) and scroll appears where content
       doesn't fit. In case of non-liquid TABs, with fixed width, it
       could be possible to automatically calculate height for no-scroll
       body via jquery-script with 3 modes:
     *
          1.
             height fixed: like now in the example.
          2.
             height max: fixed to maximum no-scroll body TAB height.
          3.
             height auto: calculating each no-scroll body TAB height.

 With all this, next steps would be: to search a little more for IE6
 STRICT mode compatibility, and to create a Jquery plugin (with CSS
 dinamically generated?)

 Any suggestions, help, critics, comments, are very welcome.

 --
 Enrique Meléndez Estrada (2367)
 Servicios Informáticos
 Organización y Servicios Internos
 Instituto Tecnológico de Aragón


  1   2   >