[jQuery] Re: jQuery prototype magic

2008-09-17 Thread Michael Geary

jQuery.fn is one of those things that exists mainly for historical reasons.

In the very first versions of jQuery, $.fn was *not* the same as
$.prototype. (There was no jQuery object by that name in those days, just a
$ object.)

$.prototype wasn't used for anything; instead, every time a jQuery object
was created, all of the method references found in $.fn were copied, one by
one, into the new jQuery object.

As you can guess, this was a bit slow, and I came up with a patch to use
$.prototype in the conventional manner instead of copying all the methods.
$.fn was kept as an alias of $.prototype for compatibility with existing
plugins that already used $.fn.

So, the code:

jQuery.fn.init.prototype = jQuery.fn;

could be written:

jQuery.prototype.init.prototype = jQuery.prototype;

What does that do? It gives the init() function the same prototype as the
jQuery object. So when you call init() as a constructor in the return new
jQuery.fn.init( selector, context ); statement, it uses that prototype for
the object it constructs. This lets init() substitute for the jQuery
constructor itself.

Now I'm curious: What's the benefit you gain by using this pattern in your
own code?

-Mike

 From: Andrei Maxim
 
 Hi all,
 
 I've recently grabbed the latest edition of the Rhino book 
 and I'm trying to build some small JavaScript libraries in 
 order to get the hang of coding in JS. I've been also reading 
 lots of blog posts and I've been looking at the code of 
 several major JS frameworks and libraries, like jQuery, 
 Prototype and script.aculo.us and I'm trying to understand 
 why the author wrote that code.
 
 For some reason, I've been growing very fond of the pattern 
 used in jQuery to create the jQuery object. Here's the code 
 I'm talking about, taken from v1.2.6:
 
 var jQuery = window.jQuery = window.$ = function( selector, 
 context ) {
   // The jQuery object is actually just the init 
 constructor 'enhanced'
   return new jQuery.fn.init( selector, context ); };
 
 [...]
 
 jQuery.fn = jQuery.prototype = {
   init: function( selector, context ) {
   // Make sure that a selection was provided
   selector = selector || document;
 
   // Handle $(DOMElement)
   if ( selector.nodeType ) {
   this[0] = selector;
   this.length = 1;
   return this;
   }
   [...]
 };
 
 // Give the init function the jQuery prototype for later 
 instantiation jQuery.fn.init.prototype = jQuery.fn;
 
 When I tried to add my custom object, I had some problems 
 with accessing the functions I defined inside 
 jQuery.prototype. Only after a couple of hours I added a line 
 similar to jQuery.fn.init.prototype = jQuery.fn and then it 
 magically worked.
 
 However, I don't get what's going on.
 
 From what I understood reading JavaScript docs, jQuery.fn = 
 jQuery.prototype means that we reference jQuery object's 
 prototype and I'm guessing this is used just to simplify the 
 code (I might be extremely wrong on this). Also, the defined 
 functions are shared by each jQuery object.
 
 But why do we need to add jQuery.fn.init.prototype = 
 jQuery.fn for things to work?
 
 Thanks a lot,
 Andrei
 



[jQuery] Re: [validate] Issues in IE6

2008-09-17 Thread Jörn Zaefferer
Works fine for me, even in IE6.

Jörn

On Tue, Sep 16, 2008 at 10:49 PM, Mattl [EMAIL PROTECTED] wrote:

 Hi,
 I've got form validation using 
 http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 working well in Firefox 2, Safari 3.1, Opera 9.5 etc but throwing up
 an error in IE6.

 I can't see what's wrong, any suggestions?

 http://www.edenvillamedical.co.uk/

 The form in question is under the 'Prescriptions' tab. 'Patient Name'
 is required.

 Appreciate any help.

 Many thanks
 Matt



[jQuery] variable substitutioin in html-snippet

2008-09-17 Thread casavecchio

Hello,

i would like to load always the same snippet of html over ajax and
dependent on the click substitute ids and classes in the loaded
snippet. How that could work?

Any suggestions

Thx Boris


[jQuery] Re: Read AJAX response in transit?

2008-09-17 Thread Michael Price

Thank you both for your suggestions - I'll give them a try and see
what I come up with. The script in question takes about 5 minutes so
if I can get something going via your suggestions it'll keep people
happy :)

Regards,
Michael Price


[jQuery] Re: Moving a opened dialog on top the windows stack

2008-09-17 Thread Richard D. Worth
See

http://groups.google.com/group/jquery-ui/browse_thread/thread/e2fe9d77db34c563

- Richard

On Wed, Sep 17, 2008 at 1:30 AM, Olive [EMAIL PROTECTED] wrote:


 Hello,

 I'm just wondering if there is any undocumented method (or trick),
 like dialog.data(), to raise (and maybe focus) an already opened
 dialog which is hidden below other dialog(s) ?

 I could mimic that by destroying the dialog, creating and opening it
 again but it is not very clean.

 Thanks,

 Olivier.



[jQuery] Re: linking two controls

2008-09-17 Thread Richard D. Worth
I'm not sure if this is exactly what you're looking for, but I wonder if
you've looked at the jQuery UI Dialog plugin:

Docs:
http://docs.jquery.com/UI/Dialog

Demos:
http://ui.jquery.com/repository/latest/demos/functional/#ui.dialog

If it interests you and you have further questions, there's a dedicated
jQuery UI mailing list:

http://groups.google.com/group/jquery-ui/

- Richard

Richard D. Worth
http://rdworth.org/

On Tue, Sep 16, 2008 at 2:28 PM, Jan Limpens [EMAIL PROTECTED] wrote:


 ah and by popup i mean something like a modal dialogue on the page,
 not another browser instance.

 On Tue, Sep 16, 2008 at 3:22 PM, Jan Limpens [EMAIL PROTECTED]
 wrote:
  hello,
 
  on several pages I have small forms (plural) with a textbox and a
  button. If I click on the button, a popup shows a search form. The
  results of the searchform are shown in the very same popup as a list
  of radiobuttons/labels. If someone selects a radiobutton, it's value
  should be inserted into the textbox next to the button. Then the popup
  should go away.
 
  This popup (something like a singleton) serves many different pages,
  so I cannot hardwire it. Probably I need to pass a delegate to some
  event the form provides, indicating the originating form. Problem is:
  I have no idea how something like this can be done. Anyone could give
  me a hint or two, or direct me to good resources on similar matters?
 
  The popup looks like that:
 
  form id=article-search-form method=get
  action=${Url.For([EMAIL PROTECTED]:'articles',
  @action:'FullTextSearchAsJson'})}
 input type=text name=fragment /
 input type=submit value=Buscar /
  /form
  form id=article-search-result method
  /form
 
  script type=text/javascript
 src=/script/jquery-1.2.6.min.js/script
  script type=text/javascript src=/script/jquery.form.js/script
 
  script type=text/javascript
 
  $(document).ready(function() {
 $('#article-search-form').ajaxForm({
 dataType: 'json',
 success: fillListWithArticles
 });
  });
 
  function fillListWithArticles(data)
  {
 var list = $(#article-search-result);
 $(list).empty();
 i = 0;
 $.each(data, function(){
 id = article-search-result- + i;
 $(divinput type='radio' value='+this.Id+'
 id='+id+'
  name='article.Id'/label style='float: inherit' for='+id+' +
  this.Name +/label/div).appendTo(list);
 i++;
 });
  }
  /script
 
  --
  Jan
  ___
  [EMAIL PROTECTED]
  www.limpens.com
  +55 (11) 3082-1087
  +55 (11) 3097-8339
 



 --
 Jan
 ___
 [EMAIL PROTECTED]
 www.limpens.com
 +55 (11) 3082-1087
 +55 (11) 3097-8339



[jQuery] Re: How to use a div as a placeholder for other divs?

2008-09-17 Thread Richard D. Worth
You can use

$(#content).empty();
// empty the element with an id of 'content'

or

$(#content div).remove()
// find all divs within the element with an id of 'content' and remove them

- Richard

Richard D. Worth
http://rdworth.org/

On Tue, Sep 16, 2008 at 4:50 PM, zephyr [EMAIL PROTECTED] wrote:


 Hi,
 I have a div id=content that serves as a placeholder for text. The
 text are all like

 div id=about
 test test test
 /div

 div id=links
 link link link
 /div

 div id=contact
 [EMAIL PROTECTED]
 /div

 When the user clicks a link, I use it's id attribute value
 (about,contact or links). I use that value to show the content of
 the corresponding div in div content. Div content is visible, the
 others are invisible
 I succeed in prepending() the div to div content:

 activeElementId = $(this).attr('id')
 $(div#content).prepend($([EMAIL PROTECTED]+activeElementId+]).html())


 but if I do this in succession, new texts get appended to exisiting.
 Of course I do not want this- I want the text about to be shown in
 content or links. Not both because append() appends! How can I
 remove a div before showing another one?

 if(typeof(activeElementId) != undefined){
$(div#content).remove($(div))
 }

 gives me an error t.substring is not a function when I click a
 second link and only the first text is shown

 Thanks



[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Richard D. Worth
This sounds like a bug to me. Better raise it on the jQuery Dev list:

http://groups.google.com/group/jquery-dev/

- Richard

On Tue, Sep 16, 2008 at 4:58 AM, tchvil [EMAIL PROTECTED] wrote:


 Hi,
 replaceWith returns the JQuery element that was just replaced.

 In the example below:
 $( 'div#old' ).replaceWith( 'divnew/div' ).html()

 It is the html of the old div that is returned.
 Is there another set of commands to get the new one returned?

 Thanks,
 tchvil


 Here is a working example:

 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/
 TR/html4/strict.dtd http://www.w3.org/TR/html4/strict.dtd
 html
head
script type=text/javascript src=
 http://jqueryjs.googlecode.com/
 files/jquery-1.2.6.pack.jshttp://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js
 /script
titleReplaceWith Chain/title
/head
body
div id=oldold/div
script type=text/javascript

  alert($('div#old').replaceWith('divnew/div').html());
/script
/body
 /html




[jQuery] best/standard way to benchmark your own scripts?

2008-09-17 Thread Alex Weber

looking to find possible bottlenecks and basically optimize the hell
outta my js which relies heavily on jquery and the occasional
plugin...

is there a more elegant and efficient way to do this than to toss a
few document.write()s at my code?? =P

thanks!!

-Alex


[jQuery] Escaping the apostrophe

2008-09-17 Thread Shawn Molloy

When I have a string that contains an apostrophe, whats the best way
to handle it?

For example, this function call throws the following error:

Function:
onclick=addQuote('This video don't work!'); return false;

Error:
missing ) after argument list
addQuote('This link don't work!'); return false;

Whats the best way to handle this scenario?

Thanks,

--shawn


[jQuery] Re: JQuery - wrap() + Internet Explorer problem

2008-09-17 Thread weidc

I allready tried 'visibility: visible' and 'display: block' but he
doesn't hide the picture's. It seems like he totally remove them.
I don't know what could change that.

On 16 Sep., 22:16, ricardobeat [EMAIL PROTECTED] wrote:
 ooops.

 yeah, everything disappears on subsequent reloads.

 As Karl said, it looks like an IE rendering bug. When you change any
 of the style properties of an element inside #content, everything goes
 back to normal. Add 'visibility: visible' to your anchors tags and see
 what happens, adjusting the CSS should solve your problem.

 On Sep 16, 4:26 am, weidc [EMAIL PROTECTED] wrote:

  Well for me it still doesn't work. I tried it in IE 6 and 7 with
  windows vista and xp.
  The first time I load the site it works but if I reload it it doesn't.

  On 15 Sep., 20:41, ricardobeat [EMAIL PROTECTED] wrote:

   Works ok for me, It's probably your IE install.

   On Sep 15, 10:26 am, weidc [EMAIL PROTECTED] wrote:

I still haven't solved it yet. Does someone got an idea?

-weidc

On 11 Sep., 13:49, weidc [EMAIL PROTECTED] wrote:

 Here's the link -http://tinyurl.com/629qpt

 It's really strange. The first 3-5 min it works and after that it
 removes the picture as I said.

 -weidc

 On 10 Sep., 18:12, Karl Swedberg [EMAIL PROTECTED] wrote:

  I'm guessing this has less to do with wrap() than with an IE 
  rendering  
  bug of some sort. If you could provide a link to page that we can 
  look  
  at, that would be helpful. My hunch is that you're dealing with a  
  hasLayout issue, but hard to tell if I can't see it.

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Sep 10, 2008, at 4:32 AM, weidc wrote:

   Hi,

   well I got some problems with wrap() and IE. It works fine in 
   FireFox
   but if I try it in IE it removes every picture beside the one I
   clicked. But if I tab in an other register in IE and tab back it 
   works
   like in FireFox.

   I wonder if there is a way to get it work with wrap() or if there 
   is
   an other way to get it like that.

   I hope someone got an idea.

   -weidc


[jQuery] Re: jQuery prototype magic

2008-09-17 Thread Balazs Endresz

In other words 'new jQuery.fn.init( selector, context )' doesn't
return a new jQuery object but a new 'init' object. But the init
object doesn't have any methods, of course, so the ones of jQuery have
to be copied over. So you couldn't access the methods because 'init'
didn't have them before.
(It could have been 'new jQuery().init( selector, context )' but that
would cause an ifinite loop as this is inside the function named
jQuery.)
I didn't see it first but the instanceof operator helped a bit :)

-Balazs

On Sep 17, 2:56 am, Andrei Maxim [EMAIL PROTECTED] wrote:
 Hi all,

 I've recently grabbed the latest edition of the Rhino book and I'm
 trying to build some small JavaScript libraries in order to get the
 hang of coding in JS. I've been also reading lots of blog posts and
 I've been looking at the code of several major JS frameworks and
 libraries, like jQuery, Prototype and script.aculo.us and I'm trying
 to understand why the author wrote that code.

 For some reason, I've been growing very fond of the pattern used in
 jQuery to create the jQuery object. Here's the code I'm talking about,
 taken from v1.2.6:

 var jQuery = window.jQuery = window.$ = function( selector, context )
 {
         // The jQuery object is actually just the init constructor 'enhanced'
         return new jQuery.fn.init( selector, context );

 };

 [...]

 jQuery.fn = jQuery.prototype = {
         init: function( selector, context ) {
                 // Make sure that a selection was provided
                 selector = selector || document;

                 // Handle $(DOMElement)
                 if ( selector.nodeType ) {
                         this[0] = selector;
                         this.length = 1;
                         return this;
                 }
         [...]

 };

 // Give the init function the jQuery prototype for later instantiation
 jQuery.fn.init.prototype = jQuery.fn;

 When I tried to add my custom object, I had some problems with
 accessing the functions I defined inside jQuery.prototype. Only after
 a couple of hours I added a line similar to jQuery.fn.init.prototype =
 jQuery.fn and then it magically worked.

 However, I don't get what's going on.

 From what I understood reading JavaScript docs, jQuery.fn =
 jQuery.prototype means that we reference jQuery object's prototype
 and I'm guessing this is used just to simplify the code (I might be
 extremely wrong on this). Also, the defined functions are shared by
 each jQuery object.

 But why do we need to add jQuery.fn.init.prototype = jQuery.fn for
 things to work?

 Thanks a lot,
 Andrei


[jQuery] css-js mouseover effects not working in ajax response

2008-09-17 Thread jey jey

Hi

I have an issue regarding the ajax response

the css-js mouseover effects not working in ajax response.

Please gimme the reason behind this. Lemme know how can we sort it
out. gimme some code snippents

Thanks in advance

joban john
?
while($life)  {
   $knowledge++ ;
}
?
1) He who lives by the sword will die by the sword..


[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Karl Rudd

Nah, it's not a bug.

replaceWith( content )  Returns: jQuery
Replaces all matched elements with the specified HTML or DOM elements.
This returns the JQuery element that was just replaced, which has been
removed from the DOM

( http://docs.jquery.com/Manipulation )

It's like doing a remove(), followed by an append(). Like remove()
it also returns (well keeps in the jQuery collection) the elements
it removes.

Karl Rudd

On Wed, Sep 17, 2008 at 8:35 PM, Richard D. Worth [EMAIL PROTECTED] wrote:
 This sounds like a bug to me. Better raise it on the jQuery Dev list:

 http://groups.google.com/group/jquery-dev/

 - Richard

 On Tue, Sep 16, 2008 at 4:58 AM, tchvil [EMAIL PROTECTED] wrote:

 Hi,
 replaceWith returns the JQuery element that was just replaced.

 In the example below:
 $( 'div#old' ).replaceWith( 'divnew/div' ).html()

 It is the html of the old div that is returned.
 Is there another set of commands to get the new one returned?

 Thanks,
 tchvil


 Here is a working example:

 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/
 TR/html4/strict.dtd
 html
head
script type=text/javascript
 src=http://jqueryjs.googlecode.com/
 files/jquery-1.2.6.pack.js/script
titleReplaceWith Chain/title
/head
body
div id=oldold/div
script type=text/javascript

  alert($('div#old').replaceWith('divnew/div').html());
/script
/body
 /html





[jQuery] Re: Escaping the apostrophe

2008-09-17 Thread Karl Rudd

You escape a quote character by putting a \ in front of it.

addQuote('This link don\'t work!');

Karl Rudd

On Wed, Sep 17, 2008 at 5:51 PM, Shawn [EMAIL PROTECTED] wrote:

 When I have a string that contains an apostrophe, whats the best way
 to handle it? Should I remove it? replace it? encode it? escape it?

 For example, this function call throws the following error:

 Function:
 addQuote('This video don't work!'); return false;

 Error:
 missing ) after argument list
 addQuote('This link don't work!'); return false;

 Whats the best way to handle this scenario?

 PS - Sorry if I double posted this : / I'm just figuring out this
 whole group thing :)

 Thanks,

 --shawn



[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Richard D. Worth
On Wed, Sep 17, 2008 at 6:58 AM, Karl Rudd [EMAIL PROTECTED] wrote:


 Nah, it's not a bug.

 replaceWith( content )  Returns: jQuery
 Replaces all matched elements with the specified HTML or DOM elements.
 This returns the JQuery element that was just replaced, which has been
 removed from the DOM

 ( http://docs.jquery.com/Manipulation )


It may be well documented, but that doesn't mean it can't be a bug. ;)



 It's like doing a remove(), followed by an append(). Like remove()
 it also returns (well keeps in the jQuery collection) the elements
 it removes.


This is quite a fundamental difference. Since .remove() returns a DOM
Element, it's not chainable. Since replaceWith() returns a chainable jQuery
object, it's reasonable to expect methods you call on that chain to effect
the new element, not your now removed/disconnected element(s). Like many
other methods, it could modify the chain. And if you wanted to get back to
the previous chain, you could call .end(). My 2c.

- Richard


[jQuery] Re: Jcrop v0.9.0 image cropping plugin - comments please

2008-09-17 Thread Richard W

Very very nice thank you Kelly.
RE ui debate: i haven't taken a look a the code of this plugin, but
from a users experience it does seem to have smoother dragging than
the jQ UI example.


On Sep 16, 7:22 pm, Jose [EMAIL PROTECTED] wrote:
 thanks.

 I am a bit confused which one should I use.  I think some plugin
 authors should be encouraged
 to  go the UI way, if the advantages are clear.

 Maybe the author can comment why he didn't pick UI as the base to
 build the plugin

 regards
 jose

 On Mon, Sep 15, 2008 at 9:38 PM, Richard D. Worth [EMAIL PROTECTED] wrote:

  jQuery UI could be used (thought it isn't in this case) to make a crop
  component like this. You would make use of three lower-level interaction
  plugins:

  Mouse (internal, in ui.core.js)
  Draggables (ui.draggable.js, builds on mouse)
  Resizables (ui.resizable.js, builds on mouse)

  So there's a bit of overlap. Here's a very simple demo of one done in that
  way:

 http://ui.jquery.com/repository/real-world/image-cropper/

  The other thing that jQuery UI would offer a plugin like this is a widget
  plugin system that abstracts out some common elements like defaults,
  options, method calls, getters/setters. I think it would quite interesting.

  - Richard

  On Mon, Sep 15, 2008 at 2:00 PM, Jose [EMAIL PROTECTED] wrote:

  hi,

  how does the plugin compare to the functionality in UI ?

  thanks and regards,
  jose

  On Tue, Sep 9, 2008 at 11:35 PM, Kelly [EMAIL PROTECTED] wrote:

   Announcing initial release of Jcrop image cropping plugin for jQuery.
   This is my first plugin release, so I would appreciate any feedback.

  http://deepliquid.com/content/Jcrop.html
   Also posted to plugins.jquery.com

   There are some rough edges in the API and a few other minor issues.
   More work to do before 1.0, but what's there is pretty functional.
   I needed to push it out or I'd keep tinkering forever...

   Thanks for looking!
   -Kelly


[jQuery] Find elements

2008-09-17 Thread shapper

Hello,

How can I find all elements in a page given a class and pass to a
function?

Or maybe better, how to I create a function that acts like a plugin,
i.e.:

Applies something to all elements of a given class.

Thanks,
Miguel


[jQuery] Separate elements

2008-09-17 Thread shapper

Hello,

I am trying to create a plugin that applies something to elements
given their CSS class.

However, I need to distinguish between the elements that are enabled
and the elements which has the property disabled = 'disabled' ...

I need this because what I apply is different dependent of being
enabled and disabled.

Thanks,
Miguel


[jQuery] jquery.com incredibly slow for me

2008-09-17 Thread micha_17

Can someone please confirm that jquery.com is sometimes (%2) so slow,
pages won't even show up after 2 minutes waiting ? The slowness has
been there before tha page has been redesigned.

I'm on winxp FF3. I's the same with my colleagues here and @home.


[jQuery] Re: Separate elements

2008-09-17 Thread MorningZ

Ever read the docs? (http://docs.jquery.com/Selectors)

There are :enabled and :disabled selectors


[jQuery] Superfish - 1:colors, 2:overlap, 3:animation removal 4:navbar spacing

2008-09-17 Thread Devin

Hello,
I have been using a menu system at work that is 10 times more
complicated than it needs to be.  Superfish does almost everything it
does and in some cases even more. So I'd like to get Superfish
implemented in my project.  I have some questions that I haven't been
able to find a quick fix to so any suggestions would be much
appreciated.

1)  In my horizontal navbar there are items.   Each drop-down menu has
its own colour scheme consisting of of 2 or 3 different colors.  I
can't find an easy way to implement this.

2) This menu/list is quite complex and deep as it is dynamically
generated by the server, so sometimes the menus can stretch too far to
the right.  What I would like to do is have the submenu have a little
bit of overlap on its parent.   I can do this but its buggy and for
the most part the parent covers up the child.

3) I would like to have no menu animation.  Boring maybe but it really
isn't necessary for my purposes

4) Ideally the menu would space evenly across the page.  My idea was
to do this with percentages but I haven't had any luck getting it to
stretch fully across the div its in.  There is always a little space
left at the right end, or one menu item ends up on the next line.

Thanks for any input you can provide!

:)

DC


[jQuery] jquery.metadata + XSLT + forms

2008-09-17 Thread googleuser

Hello,
In XSL if { is in atribute XSLT processor try to resolve expresion.
Jquery metadata uses { to process data, in old version of metada I
try metadata with [, with this:

if ( /^\[.+\]$/.test( data ) ){
data = data.replace([, {);
data = data.replace(], });
}

but do not seems a good choice modify jquery metadata plugin in each
update.

¿Anyone knows a alternative?


[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread Konstantin Tokar

At me the site is loaded for some seconds.
try traceroute jquery.com - and

On 17 сент, 16:30, micha_17 [EMAIL PROTECTED] wrote:
 Can someone please confirm that jquery.com is sometimes (%2) so slow,
 pages won't even show up after 2 minutes waiting ? The slowness has
 been there before tha page has been redesigned.

 I'm on winxp FF3. I's the same with my colleagues here and @home.


[jQuery] Re: Find elements

2008-09-17 Thread BB

$(.myClass).each(function() {
  // this = DOM Element = $(this) = jQuery Object
});

On 17 Sep., 13:55, shapper [EMAIL PROTECTED] wrote:
 Hello,

 How can I find all elements in a page given a class and pass to a
 function?

 Or maybe better, how to I create a function that acts like a plugin,
 i.e.:

 Applies something to all elements of a given class.

 Thanks,
 Miguel


[jQuery] Re: jQuery Validation Errors

2008-09-17 Thread GregWa

I figured out the problem.

In IE, if you have not set a class, even an empty class would suffice
(class=), it will throw that error. I never saw this in the
documentation, which I feel could use some work as is to be clearer.
As such, I am not sure whether this is a known problem or coding
problem.

On Sep 15, 5:53 pm, Jörn Zaefferer [EMAIL PROTECTED]
wrote:
 Please provide a testpage.

 Jörn

 On Mon, Sep 15, 2008 at 4:50 PM, GregWa [EMAIL PROTECTED] wrote:

  In FF3 I am having no issues with the plugin, but in IE (only tested
  7) I am running into the following problem.

 http://i34.tinypic.com/2vnovic.png- Line:662, Error: 'undefined' is
  null or not an object. The offending piece of code goes over to jQuery
  1.2.6 and this is where it errors.

  data: function( elem, name, data ) {
                 elem = elem == window ?
                         windowData :
                         elem;

                 var id = elem[ expando ];

  elem is what is undefined

  Here is the code I'm using to execute the validation:

             validator = $('#form1').validate();
             var input = $('ul.MDProgramsList :input').eq(0);
             input.each(function() { $(this).rules('add', { required:
  true }); });

             valid = validator.form();
             input.rules('remove');

  When I make elem = to windowData it then proceeds to another error.
  I'm not quite sure what is going on to cause this problem in IE.




[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread GregWa

I have the same exact problem. It has been this way for so long, even
before the site redesign, that they simply must not have funds to
properly run the site it seems.

On Sep 17, 8:30 am, micha_17 [EMAIL PROTECTED] wrote:
 Can someone please confirm that jquery.com is sometimes (%2) so slow,
 pages won't even show up after 2 minutes waiting ? The slowness has
 been there before tha page has been redesigned.

 I'm on winxp FF3. I's the same with my colleagues here and @home.


[jQuery] Re: multiple getJSON calls appear to wait for first response to run any callbacks in FF?

2008-09-17 Thread Josh Rosenthal
Sorry for not following up... looks like I missed your response while I was
away.
However, I'm reasonably sure I don't understand.  It doesn't seem like
getJSON is supposed to wait... wraps with the callback function, and thus
should run when there is a return.  Can you give a bit more detail, or point
me to an similar structure as what you describe?

Thanks!
josh

On Sat, Sep 6, 2008 at 8:36 AM, Rene Veerman [EMAIL PROTECTED] wrote:

 don't wait for any response, just poll an array of 'open' responses and
 handle whichever are ready?


 On Thu, Sep 4, 2008 at 3:13 PM, Josh Rosenthal [EMAIL PROTECTED] wrote:

 Hey all,
 I'm building a google map based application which allows users to query a
 number of different json returning data lookup services  (ie: get Tax Parcel
 for this coordinate... get address, get USGS Quad Name, get Place Name).
  Each service is activated by clicking a different button, etc.  While some
 of these queries run pretty fast, others (parcels), take ~ 30-40 seconds.
  Working in Firefox 3, I've found that once a user runs the slow getJSON,
 none of the other queries will run their callback, until that slow getJSON
 finishes.  However, when I watch in firebug, I can see that we've actually
 queried and gotten a valid, wrapped response, and we're just waiting to
 process it.  Basically, the jsonp calls may be asynchronous, but we get a
 bottleneck where we're waiting for the response to one jsonp call, but
 already get the answer to another, and yet have to wait til the first
 returns in order to do our second callback.

 IE7 appears to display more correct behaviour, with the callbacks firing
 in the order that responses are received.

 Any suggestions as to how to get FF3 to behave similarly?

 -Josh





[jQuery] cascade question

2008-09-17 Thread kevin

Hi all,

here is my sample page  http://sskes.damimi.org/test/

my question is how can i let the first box selected on B and also
trigger second box list the correct value
B1,B2,B3,B4 automatically when page loaded.

thanks.



[jQuery] [validate] Pb with button

2008-09-17 Thread cage31

Hi,

I would like  validate my form with the validate plugin.
I have a little problem. In my form, there are button with metadata.
So the html look like this :

button id=btnCancel class=bnbutton {bnAction:131328}
type=button

Unfortunately, the plugin control the button and search the validation
method 'bnAction'.

1. Why is the plugin control the button ? It's not an input element.
2. The pluggin hang because the validation method doesn't exist. What
can I do ?

I'll surely have the same problem with select.

Thanks

Gerard


[jQuery] IE7innerHTML and text normalization

2008-09-17 Thread Paul

Hi All,

I'm trying to replace all linebreaks with html br /, but due html
normalization with the innerHTML propery in IE7 the following piece of
code won't work in IE7

div id=text
thingy 1
thingy 2
/div

script
var str = $('#text').html();
$('#text').html(str.replace(/\n/g, br /));
/script

(description of the normalization bug:
http://www.quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html)

Does anyone has a crossbrowser workaround or another solution to this
problem?

Thanx in advance!

-Paul




[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread vld

Same here. OSX 10.5.5 FFX3, Safari, Problems are both from home and
corporate.

On Sep 17, 7:30 am, micha_17 [EMAIL PROTECTED] wrote:
 Can someone please confirm that jquery.com is sometimes (%2) so slow,
 pages won't even show up after 2 minutes waiting ? The slowness has
 been there before tha page has been redesigned.

 I'm on winxp FF3. I's the same with my colleagues here and @home.


[jQuery] Re: Hover on all elements: $(*).hover(...)

2008-09-17 Thread benjam

This is insanely kludgy, not very pretty, and probably slower than a
more elegant solution.

But it works.

$('*').hover(
function(event) {
var $this = $(this);
$this.addClass('selected');
$this.parents( ).removeClass('selected');
},
function(event) {
var $this = $(this);
$this.removeClass('selected');
$this.parents( ).removeClass('selected');
$this.parent( ).addClass('selected');
$this.children( ).removeClass('selected');
}
);

I'm sure there are better solutions out there, but this was the
fastest and easiest method.

On Sep 17, 2:04 am, Balazs Endresz [EMAIL PROTECTED] wrote:
 I'm not sure I get it, but if you want to grab the strong inside a
 p when the event is only bound to p then you can get it simply by
 event.target:

 $('body').find('*').filter(function(){
   return !$(this).children().length;})

 .add('p').not('p *')
 .hover(function(event){

     var t=event.target  //this will be the strong tag inside the p

     if ($(this).children().length()  0) {
        return False
     }

     $(this).addClass('selected');
   },
   function(){
      $(this).removeClass('selected');
   }
 );

 You can also try this with event delegation, which will be much faster
 with a lot of 
 elements:http://dev.distilldesign.com/log/2008/jan/27/event-delegation-jquery/http://lab.distilldesign.com/event-delegation/

 On Sep 16, 7:17 pm, John Boxall [EMAIL PROTECTED] wrote:

  Hi Balazs,

  Thanks for the reply - looking at your suggestion, my idea was to
  apply it to the code like this:

  $(function() {
          $(*).hover(
             function(){

                  // If the element has more than one child stop
  propagating.
                  if ($(this).children().length()  0) {
                      return False
                  }

                  $(this).addClass('selected');
              },
              function(){
                  $(this).removeClass('selected');
              }
          );

  }

  This is _close_ to what I want, but what I'd really like is to grab
  DOM element you are hovering over with the minimum number of children
  - not necessarily zero.

  It's my understanding that with the above, if you hovered over a p
  with a strong inside you couldn't select the p because it would
  have a child!

  Thanks,

  John

  Should only return true if the selected $(this) has no children.
  This is _close_ to what I want - but what I'd really like is to grab
  the element

  On Sep 14, 4:10 am, Balazs Endresz [EMAIL PROTECTED] wrote:

   Hey John,

   I think this will do that:

   $('body').find('*').filter(function(){
     return !$(this).children().length;})

   .add('p').not('p *') //without this, if a paragraph contains tags 
   thehoverwon't be applied to the most of the text

   On Sep 12, 9:29 pm, John Boxall [EMAIL PROTECTED] wrote:

Heyo jQuery hackers,

I'm putting together a little script that adds a class selected to
an element when youhoverover it.
When you stop hovering the class selected class is removed.

I would like the class only to be apply to the lowest element in the
DOM.

For example say I was hovering over a p deep inside a document - I
would like to only add the class selected to that p tag, not the
div, body and html tags surrounding it.

So far my thinking has been to use something like this:

$(function() {
        $(*).hover(
           function(){
                $(this).addClass('selected');
            },
            function(){
                $(this).removeClass('selected');
            }
        );

}

Which adds the selected class to any element Ihoverover fine. It
also removes it.

The problem is thehoveris firing all the way up the chain and
hitting all elements from the lowest to the highest so I've got a ton
of ugly selected elements when I really just wanted the lowest one...

Is there any way I can restrict it?

Thanks,

John


[jQuery] Re: this.style is null or not an object

2008-09-17 Thread MorningZ

Are you sure the ID of the object is showError?

Because if it's a server side control and you are using UserControls
or MasterPages, then the ID of the object will get prepended by IDs of
it's containers

To confirm this is or isn't happening, simply do a View Source of
the HTML and find that control and check the generated id property


[jQuery] Re: this.style is null or not an object

2008-09-17 Thread Eric Martin

It sounds like an issue with your page. Do you have any code examples
or a page that I can view?

On Sep 17, 5:40 am, kimoy [EMAIL PROTECTED] wrote:
 Hi,

 I'm developing on ASP.NET and have been trying to make the SimpleModal
 plugin work but somehow the jQuery.hide() function throws an error
 'this.style is null or not an object'.

 This is my jQuery code:

 jQuery(document).ready(function(){
         jQuery('#showError').modal();

 });

 Thanks.


[jQuery] Re: custom / slimmed-down jquery possible?

2008-09-17 Thread Eric Martin

Alex -

I briefly went through jQuery and removed some of the unused parts (as
it relates to SimpleModal). I was able to get it down to just under
75k, 42k minified (which is about 12k less that the non-modified
version). I can't make any guarantees, but if you'd like to try the
slimmed down version, just send me an email.

I don't really see how 55k would really cripple your load times -
especially if you are loading the scripts near the bottom of your
page. In addition, if you are using compression, you should hardly
notice the loading time for the script(s).

-Eric


On Sep 17, 1:20 am, Alex Weber [EMAIL PROTECTED] wrote:
 and no i dont mean packing or minifying! :)

 basically all i need is 1 plugin (simplemodal) and because of that i'm
 forced to load the entire jquery library, which is crippling load
 times...

 we use jquery extensively in our website but we have banners in other
 sites that open a simplemodal (lightboxish) dialog and as far as the
 banners are concerned since its many sites and many different viewers
 we can't really count on caching to help either...

 so here's my question, is it possible to strip-down the original
 jquery source code *just* for the banner modal?
 i guess it could be a kind of trial and error thing, but i'm wondering
 how interconnected the seperate parts of the library are and whether i
 should even spend any time on this...

 although it seems silly to have to load almost 50kb of additional JS
 when all i want is a 5Kb plugin :)

 thanks!

 -Alex


[jQuery] get an image from an input field just with javascript

2008-09-17 Thread ^AndreA^

Hello everybody,

I wonder, is it possible to load an image (which the user is choosing
by a form) directly with javascript without submitting the form?

For instance, I could have:

form
  strongPage Background: /strong
  input id=bg_image_path type=file name=bg_image  /
  emUpload the image that you want to use as a background./
em

  a id=preview_btn href=javascript:void(0); PREVIEW/a

  input type=submit value=SUBMIT class=form_button
/form

If they press SUBMIT the form goes to the server but, if before, they
want to see a preview they can have it clicking the PREVIEW link... of
course. ;-)

I'm working on this preview just using javascript, is there a way to
get the picture and not the just path???

Because if I write:

$(#bg_image_path).val();

I'll get just the path.

Thanks in advance.

Andrea


[jQuery] Re: jQuery Validation Errors

2008-09-17 Thread Jörn Zaefferer
Well, the documentation is a wiki, you're welcome to help improving
it. If you aren't sure about a change you make, notify me or others
about the change by posting to the list.

If you think its a bug in the plugin, please create a ticket:
http://dev.jquery.com/newticket (requires registration)

Jörn

On Wed, Sep 17, 2008 at 4:16 PM, GregWa [EMAIL PROTECTED] wrote:

 I figured out the problem.

 In IE, if you have not set a class, even an empty class would suffice
 (class=), it will throw that error. I never saw this in the
 documentation, which I feel could use some work as is to be clearer.
 As such, I am not sure whether this is a known problem or coding
 problem.

 On Sep 15, 5:53 pm, Jörn Zaefferer [EMAIL PROTECTED]
 wrote:
 Please provide a testpage.

 Jörn

 On Mon, Sep 15, 2008 at 4:50 PM, GregWa [EMAIL PROTECTED] wrote:

  In FF3 I am having no issues with the plugin, but in IE (only tested
  7) I am running into the following problem.

 http://i34.tinypic.com/2vnovic.png- Line:662, Error: 'undefined' is
  null or not an object. The offending piece of code goes over to jQuery
  1.2.6 and this is where it errors.

  data: function( elem, name, data ) {
 elem = elem == window ?
 windowData :
 elem;

 var id = elem[ expando ];

  elem is what is undefined

  Here is the code I'm using to execute the validation:

 validator = $('#form1').validate();
 var input = $('ul.MDProgramsList :input').eq(0);
 input.each(function() { $(this).rules('add', { required:
  true }); });

 valid = validator.form();
 input.rules('remove');

  When I make elem = to windowData it then proceeds to another error.
  I'm not quite sure what is going on to cause this problem in IE.





[jQuery] Re: [validate] Pb with button

2008-09-17 Thread Jörn Zaefferer
The plugin should ignore buttons by default, thats a bug. Could you
create a ticket for this? http://dev.jquery.com/newticket (requires
registration)

Meanwhile, to work around it you can specifx the meta-option to
namespace metadata for validation. Just set meta: validate and the
button should be ignored.

Jörn

On Wed, Sep 17, 2008 at 3:49 PM, cage31 [EMAIL PROTECTED] wrote:

 Hi,

 I would like  validate my form with the validate plugin.
 I have a little problem. In my form, there are button with metadata.
 So the html look like this :

 button id=btnCancel class=bnbutton {bnAction:131328}
 type=button

 Unfortunately, the plugin control the button and search the validation
 method 'bnAction'.

 1. Why is the plugin control the button ? It's not an input element.
 2. The pluggin hang because the validation method doesn't exist. What
 can I do ?

 I'll surely have the same problem with select.

 Thanks

 Gerard



[jQuery] simple if not :checked then show div - BEGINNER

2008-09-17 Thread tlob

Hello

I try to do a very simple thing. 7 Checkboxes. 1 submit.
If none checked, show div#none
if not checkbox1:checked show div#not1
and if not checkbox2:checked show div#not2, too
and so on...

I can do it with man if then's, but I like it slick and sexy!
And I cant figure it out.

Thx in advance



[jQuery] getting/setting height() in IE6 quirks mode behaves inconsistently

2008-09-17 Thread Matt Kruse

In IE6, quirks mode, I expect this to not change their height of an
object:

var h = $obj.height();
$obj.height(h);

However, it does cause a re-size (if the object has padding/borders).
Is this intended?
( Using: http://code.jquery.com/jquery-latest.pack.js )

It looks like when height() is called, it returns the internal height,
minus borders and padding.
When height(val) is called, the height includes borders and padding.

I believe these should behave consistently in quirks mode. In
standards mode they work fine.

For now I will write a fix that switches based on compatMode.

Matt Kruse


[jQuery] Re: get an image from an input field just with javascript

2008-09-17 Thread config

You can't view the file because of security restrictions.

A *long* time ago one could grab the path and call it with the file://
protocol, but this is now blocked in most (all?) browsers. Similarly,
one can't write a path into the file input.

G.


[jQuery] Problem with moving iframe using append, iframe's head and body are wiped out

2008-09-17 Thread zwaugh

I'm using the tinyMCE editor in a site to edit content for multiple
projects. Loading tinyMCE creates an iframe, which in itself works
fine. In the site, instead of creating a tinyMCE instance for every
project, I'm creating it once and then just moving it to the active
project. I'm doing that like this:

$('.active_project').append($(#editor); //#editor is a div that
contains the tinyMCE editor and some other fields

But when it is moved the head and body of the iframe are emptied, and
obviously the editor no longer functions. I'm not sure if it's a bug,
or I'm doing something wrong, or if there is a better to way to move
DOM fragments around. Any help is appreciated. Thanks


[jQuery] Re: finding the state of slideToggle

2008-09-17 Thread Michael

Thank you. Still no luck though - it says ...is open no matter if
it's open or closed. Here's what my function looks like now:

function initMenu() {
$('#groups ul').hide();
$('#groups li a').click(
function() {
$(this).next().slideToggle('normal');
var id = $(this).attr('id');
if ($(this).next().is(':hidden')) {
var state = closed;
} else {
var state = open;
}
alert($(this).next().attr('id') + ' is ' + state);
return false;
}
);
}

And you can still test it here:
http://www.viktorwithak.com/Test/nav/

Thanks,

Michael

On Sep 16, 11:34 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
 Hi Michael,

 You're doing the slideToggle() on $(this).next(), but checking the  
 visibility state of $(this). I imagine that the link you're clicking  
 is always visible. You should probably do a check for $
 (this).next().is(':hidden')

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Sep 16, 2008, at 5:24 PM, Michael wrote:



  I have a slideToggle functioning just fine on my page:

 http://www.viktorwithak.com/Test/nav/

  But I'm trying to get it to set a cookie that remembers what is closed
  and what is open. So, step one, I'm trying determine (on click) what
  the state of slideToggle is. Here is my code so far...

  function initMenu() {
     $('#groups ul').hide();
     $('#groups li a').click(
             function() {
                     $(this).next().slideToggle('normal');
                     var id = $(this).attr('id');
                     if ($(this).is(:hidden)) {
                             var state = closed;
                     } else {
                             var state = open;
                     }
                     alert(id + ' is ' + state);
                     return false;
             }
     );
  }

  ...but everytime I click, I get the message slide_toggle_# is open.
  Can you please take a look at my if statement and let me know how to
  determine the slide_toggle state? Once I get that working, I should be
  able to figure out myself how to save the state for every ID to the
  cookie. Thanks!


[jQuery] Re: best/standard way to benchmark your own scripts?

2008-09-17 Thread ricardobeat

Do you use Firebug? It has a Profile option under the Console tab,
that will profile (duh) all js action going on while it's on, giving
you details like number of function calls and the time each took to
execute, that's plenty of information ;)

ricardo

On Sep 17, 1:14 am, Alex Weber [EMAIL PROTECTED] wrote:
 looking to find possible bottlenecks and basically optimize the hell
 outta my js which relies heavily on jquery and the occasional
 plugin...

 is there a more elegant and efficient way to do this than to toss a
 few document.write()s at my code?? =P

 thanks!!

 -Alex


[jQuery] Re: borders work fine with all browsers except IE7

2008-09-17 Thread Namlet

Ok, point taken, but I have a CSS file, a JS file, and an XHTML files,
each are about 300 lines.  That's a little too much for this textbox,
so how can I post this info for you to see?  It's not a public
website.  Is there some online service that hosts text displaying
versions of this stuff?



On Sep 16, 1:53 pm, ricardobeat [EMAIL PROTECTED] wrote:
 Impossible to help without seeing some code. I don't see any magical
 jQuery gurus around.

 On Sep 16, 12:01 pm, Namlet [EMAIL PROTECTED] wrote:

  I have a site with several borders that are part of jQuery commands.
  One has rounded corners, others don't.  IE7 doesn't render ANY of
  these borders.  There are two divs that are not touched by jQuery, and
  their borders work fine.  Everything that has a jQuery click event, or
  rounded corners has no border at all.  Any ideas?


[jQuery] Re: Jcrop v0.9.0 image cropping plugin - comments please

2008-09-17 Thread Kelly

Thanks Richard W. And thanks to everyone who has commented.
I am glad that most of the issues raised have been purely
philosophical. :)

Jose, please use whatever plugin you feel is best suited for you
needs.
The whole purpose of a plugin is you don't need to worry about what's
inside.
If you have a conviction that you want to use jQuery UI somewhere,
please do.

I've seen that jQuery UI-based cropping demo and frankly it's broken.
I don't think that's jQuery UI's fault, but it does not make a very
compelling demo.
Nor does the demo include documentation, downloads, or anything else I
can see.

Surely jQuery UI could have been used, but I was not/am not familiar
enough with it.
Therefore, I cannot comment if it would actually benefit more than my
coding time.
I also wanted to minimize the codebase and dependencies.

I do plan to experiment with the UI libraries. If they prove
beneficial, a future release may use it.
Or, I may incorporate some of UI's optimizations in my own code, if
applicable.

As with the naming (e.g. Jcrop vs. jCrop), these are issues I
considered a lot.
It's very possible that I made some wrong choices.

This is the first time I've ever seen lack of a dependency as a
detriment to someone.
Ultimately, I choose plugins based on other factors.

-Kelly


On Sep 17, 4:41 am, Richard W [EMAIL PROTECTED] wrote:
 Very very nice thank you Kelly.
 RE ui debate: i haven't taken a look a the code of this plugin, but
 from a users experience it does seem to have smoother dragging than
 the jQ UI example.

 On Sep 16, 7:22 pm, Jose [EMAIL PROTECTED] wrote:

  thanks.

  I am a bit confused which one should I use.  I think some plugin
  authors should be encouraged
  to  go the UI way, if the advantages are clear.

  Maybe the author can comment why he didn't pick UI as the base to
  build the plugin

  regards
  jose

  On Mon, Sep 15, 2008 at 9:38 PM, Richard D. Worth [EMAIL PROTECTED] wrote:

   jQuery UI could be used (thought it isn't in this case) to make a crop
   component like this. You would make use of three lower-level interaction
   plugins:

   Mouse (internal, in ui.core.js)
   Draggables (ui.draggable.js, builds on mouse)
   Resizables (ui.resizable.js, builds on mouse)

   So there's a bit of overlap. Here's a very simple demo of one done in that
   way:

  http://ui.jquery.com/repository/real-world/image-cropper/

   The other thing that jQuery UI would offer a plugin like this is a widget
   plugin system that abstracts out some common elements like defaults,
   options, method calls, getters/setters. I think it would quite 
   interesting.

   - Richard

   On Mon, Sep 15, 2008 at 2:00 PM, Jose [EMAIL PROTECTED] wrote:

   hi,

   how does the plugin compare to the functionality in UI ?

   thanks and regards,
   jose

   On Tue, Sep 9, 2008 at 11:35 PM, Kelly [EMAIL PROTECTED] wrote:

Announcing initial release of Jcrop image cropping plugin for jQuery.
This is my first plugin release, so I would appreciate any feedback.

   http://deepliquid.com/content/Jcrop.html
Also posted to plugins.jquery.com

There are some rough edges in the API and a few other minor issues.
More work to do before 1.0, but what's there is pretty functional.
I needed to push it out or I'd keep tinkering forever...

Thanks for looking!
-Kelly


[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread ffub

It's very slow. Does anyone know of a mirror anywhere? Could not
Google, IBM, or one of those big users maybe help out with some
sponsoring or hosting?

On Sep 17, 1:30 pm, micha_17 [EMAIL PROTECTED] wrote:
 Can someone please confirm that jquery.com is sometimes (%2) so slow,
 pages won't even show up after 2 minutes waiting ? The slowness has
 been there before tha page has been redesigned.

 I'm on winxp FF3. I's the same with my colleagues here and @home.


[jQuery] nth-child(n) not working for me.

2008-09-17 Thread kcharles

I switch between var n = 2; nth-child(n) and nth-child(2) and get
different behavior.
Any suggestions/work arounds?
Thanks!

Here is the code:

html
 head
 titlenth child/
title
 script type=text/javascript src=jquery.js/script
 script type=text/javascript
 //Add input box for each column

 $(function(){
 var n = 2;
//   $(#filterTable tbody tr td:nth-child(2)).each(function(){
 $(#filterTable tbody tr td:nth-child(n)).each(function(){
 $(this).append(this row);
 });
 });





/
script
 /
head
 body


table id=filterTable  width=580 border=1
thead
tr
thNumber/th
thLetter/th
thMore/th
/tr
/thead

tbody
tr
td1/td
tdA/td
tdA/td
/tr

tr
td2/td
tdA/td
tdB/td
/tr

tr
td3/td
tdB/td
td3/td
/tr

tr
td4/td
tdB/td
tdD/td


/tr
/tbody
/table


 /
body
 /html


[jQuery] Re: custom / slimmed-down jquery possible?

2008-09-17 Thread ricardobeat

Don't feel tied to jQuery. There are many lightbox scripts offering
modal dialogs, independent from any library, with less than 10kb
uncompressed. Just google lightbox.

On Sep 17, 12:45 pm, Eric Martin [EMAIL PROTECTED] wrote:
 Alex -

 I briefly went through jQuery and removed some of the unused parts (as
 it relates to SimpleModal). I was able to get it down to just under
 75k, 42k minified (which is about 12k less that the non-modified
 version). I can't make any guarantees, but if you'd like to try the
 slimmed down version, just send me an email.

 I don't really see how 55k would really cripple your load times -
 especially if you are loading the scripts near the bottom of your
 page. In addition, if you are using compression, you should hardly
 notice the loading time for the script(s).

 -Eric

 On Sep 17, 1:20 am, Alex Weber [EMAIL PROTECTED] wrote:

  and no i dont mean packing or minifying! :)

  basically all i need is 1 plugin (simplemodal) and because of that i'm
  forced to load the entire jquery library, which is crippling load
  times...

  we use jquery extensively in our website but we have banners in other
  sites that open a simplemodal (lightboxish) dialog and as far as the
  banners are concerned since its many sites and many different viewers
  we can't really count on caching to help either...

  so here's my question, is it possible to strip-down the original
  jquery source code *just* for the banner modal?
  i guess it could be a kind of trial and error thing, but i'm wondering
  how interconnected the seperate parts of the library are and whether i
  should even spend any time on this...

  although it seems silly to have to load almost 50kb of additional JS
  when all i want is a 5Kb plugin :)

  thanks!

  -Alex


[jQuery] apples webclip feature in jquery

2008-09-17 Thread Tom Shafer

I am wanting to write something like apples webclip feature in safari
for jquery, I am trying to figure out where the best place to start
is. Does anyone have any ideas?

Thanks,

-TJ


[jQuery] hover() with mouseout() problem

2008-09-17 Thread pawel.szymula

Hi,
I'm having some problems - i'm sure they're lame, but i can't handle
with them by myself. Any help really appreciated :)

So, here's the problem:

I'm moving mouse over menu item, then a submenu (beneath the main
menu) shows up. I'd like to move mouse around the submenu, but it
dissapears.

How to make submenu visible (and clickable, because it contains an
unsorted list) and make it dissapear after moving mouse out from it?

Here's the code:

$(document).ready(function(){
$(#trzy).hover(
  function(){
$('#dwaOver').animate({
opacity: 1
}, 200);
  },
  function(){
$('#dwaOver').animate({
opacity: 0
}, 100);


  }
);

})

BTW. Sry for my english


[jQuery] Re: Bind events on DOM elements inserted from other frame

2008-09-17 Thread ricardobeat

using the iframe's jQuery object:

$('.classinparentframe', parent.window.document)

Ideally if the contents of the iframe are always known to you, you
should use only one instance of jQuery on the parent window and do all
your stuff from it, it's simpler to debug also.

On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote:
 Thanks Ricardo.

 But what if I wanted to access the parent document from WITHIN the
 iframe?

 On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote:

  You need to understand that a frame is another 'window' instance, it
  doesn't have the same jQuery object as the parent window unless you
  tell it to. So the '$' object you use in firebug console is always the
  one from the parent window.

  If i'm not mistaken you can acess frame content with the parent
  window's jQuery object using $('.classinsidetheframe',
  frames['name'].document).css();

  On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote:

   Ok Brandon,

   I found this in another post:

   var doc = $('#testframe')[0].contentWindow.document;
   $(doc.body).append('spantest/span');

   This seems like it would help, but I am not sure how to use this,
   along with what you posted to get it working correctly.  Somehow
   sending the GET within the context of the contentWindow is confusing
   me, and I just can't get it working.

   On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote:

To see what I mean run this in Firebug:
$('iframe')[0].contentWindow.$ = $;

Then click on the link in the iframe and it will behave as you expect.

--
Brandon Aaron

On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote:

 This would work if you used the frames parent instance of jQuery. 
 LiveQuery
 works by monitoring the DOM methods within jQuery. Since within the 
 frame
 you are using a new instance of jQuery, LiveQuery will not be 
 monitoring its
 DOM methods.
 --
 Brandon Aaron

 On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote:

 I can confirm that using event delegation will fix this problem.  I
 guess that it is just a problem with the LiveQuery plugin.  Brandon,
 if you are where around here, could you comment on this?

 Thanks.

 On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote:
  I have a working example of this, and would really like help
  understanding why bind or livequery does not bind events to DOM
  elements that are inserted from an iframe.

 http://web2.puc.edu/PUC/files/bind.html

  Clicking the insert from frame link will append links to the 
  parent
  frame, which won't pick up the click event.  But, clicking the 
  insert
  from body link will append links within the same frame and will
  correctly have the click events bound.

  Why is this happening?

  On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote:

   I have been experiencing strangeness with trying tobindevents to 
   DOM
   elements that have been inserted from a different frame using 
   .get().
   For some reason the elements don't be binded with the events if 
   they
   are inserted from other frame.  In testing, if I try the same
 thingwithinthe SAME frame the the events get binded correctly.

   Am I missing something here?  Is this a limitation of jQuery?


[jQuery] nth-child(n) not working for me - I didn't see my previous post

2008-09-17 Thread kcharles

I switch between var n = 2; nth-child(n) and nth-child(2) and get
different behavior.
Any suggestions/work arounds?
Thanks!

Here is the code:

html
head
titlenth child/title
script type=text/javascript src=jquery.js/script
script type=text/javascript
//Add input box for each column

$(function(){
 var n = 2;
//   $(#filterTable tbody tr td:nth-child(2)).each(function(){
 $(#filterTable tbody tr td:nth-child(n)).each(function(){
 $(this).append(this row);
 });
});

/script
/head
body


table id=filterTable  width=580 border=1
thead
tr
thNumber/th
thLetter/th
thMore/th
/tr
/thead

tbody
tr
td1/td
tdA/td
tdA/td
/tr

tr
td2/td
tdA/td
tdB/td
/tr

tr
td3/td
tdB/td
td3/td
/tr

tr
td4/td
tdB/td
tdD/td


/tr
/tbody
/table


/body
/html


[jQuery] Re: accordion open in different sections?

2008-09-17 Thread JohnieKarr

Hi Kevin,

I did this on one of the website I maintain: 
http://www.lovinggodlovingyouonline.com
and also, the navigation menu is in the includes.

To further complicate things, I use page.php?id=pageID to load each
page, so I'm not even pulling seperate pages.  Also, not always is
page.php used...for example the contact pages.

So, the method I came up with (and you can view the source code to get
a better understanding of this) is I created an IF/Then checking
mechnasm to get the proper section of the menu to display.

1, get the url
2, if there are paramaters, what are they.

If paramater = 1 then open section Main, if 15 then open section Misc
-- for example.

Where there is no paramater, if page = contact.php then open section
contact.

Click the link and view the source...you will get the idea.

Johnie
On Sep 16, 11:27 am, KEVIN EVANS [EMAIL PROTECTED] wrote:
 Hello,

 I am working on a site where I am using the Accordion script 
 fromhttp://docs.jquery.com/UI/Accordion
   on the left navigation.

 You have an option to keep a section open by defaultbut I need to  
 change which button is opened depending on which section you are in,  
 and I have that accordion menu in a include so I dont see how you can  
 do it.

 The one that is open by default has a class of opener.

 Any ideas?

 Kevin


[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread acacio

I had the same problem so I switched to the Google hosted files and
it's *much* faster.
Also, if we use it systematically, the client browser caches the files
between different apps.

You need to replace the load to this:

  script src=http://www.google.com/jsapi;/script
  script
// Load jQuery
google.load(jquery, 1.2);
google.load(jqueryui, 1.5);
  /script

Nothing else needs to be changed.

A good article on the subject:
http://ajaxian.com/archives/announcing-ajax-libraries-api-speed-up-your-ajax-apps-with-googles-infrastructure

-Acacio

On Sep 17, 7:05 pm, John Resig [EMAIL PROTECTED] wrote:
 We just acquired four new servers from Media Temple, yesterday. We'll
 be moving the various sub-domains (docs, plugins, dev, ui) to their
 own unique servers this week - this should help with load times
 significantly.

 But yes, it's mostly due to popularity issues (we're getting the
 equivalent of about 4 Digg/Slashdot-ings worth of traffic, per day, at
 this point).

 On 9/17/08, misterqj [EMAIL PROTECTED] wrote:





  I have experienced the same thing. Based on other messages in this
  newsgroup, I think it is a combo of hosting issues and jQuery's
  popularity. On one hand, it is great that the toolkit is being so
  widely used, but on the other hand it seems that the resources aren't
  keeping up with demand.

  It is a free toolkit, though, so I am not inclined to complain too
  much. But if they need additional resources, it might be time for the
  community to kick in a little $$.

  On Sep 17, 7:30 am, micha_17 [EMAIL PROTECTED] wrote:
  Can someone please confirm that jquery.com is sometimes (%2) so slow,
  pages won't even show up after 2 minutes waiting ? The slowness has
  been there before tha page has been redesigned.

  I'm on winxp FF3. I's the same with my colleagues here and @home.

 --
 --John


[jQuery] Selecting a nested Ajax Tab from a link

2008-09-17 Thread spyFly

Hello!

I am using UI Tabs...and I think it is GREAT!
Q: Is there an easy way to navigate to a Nested Ajax Tab from the main
tabbed page?

I have created a tabbed page with Ajax content:
http://www.edh.realmdigital.co.za/productgroup/golf/60
The first Tab has nested Ajax tabs.
For the life of me I cannot figure out how to select a SPECIFIC nested
tab from a link on the main page.
If you click on Buy Now I need to go to the first main tab and then
to the 3rd nested tab within.

I can select the main tab, but how do I tell it to select the 3rd
nested tab (only when you click on 'buy now')

$('.buynow a').click(function() {
$('#main  ul').tabs('select',0);
return false;
});

So what i need is click buynow -- goto Main Tab (0) and then when
the nested tabs are built -- goto Nested Tab 3.

Any advice will be greatly appreciated.

Kind Regards
Nico


[jQuery] Re: How to serialize an Object to JSON String without making it POST like?

2008-09-17 Thread Namlet

So I need to write my own JSON serializer or is there something
already available?

If I do need to write my own, how can I contribute it back to the
community?

Thanks!

On Sep 16, 4:28 pm, Mike Alsup [EMAIL PROTECTED] wrote:
  When I use this function to create a JSON object:

  var formObject = $(:input).serialize();

  and I print it, I get name=valuename=value...  This isn't proper
  JSON string and the .NET webservice I'm sending it to barfs.

  How can I make it stay in the proper format, i.e.

  {'fname':'dave', 'lname':'ward'}

  Thanks!

 jQuery's serialize method does not create JSON strings.  It creates
 URL-encoded strings, as you discovered.


[jQuery] Re: JQuery - wrap() + Internet Explorer problem

2008-09-17 Thread ricardobeat

Install IE Developer toolbar and check it, the images are still there.

On Sep 17, 4:23 am, weidc [EMAIL PROTECTED] wrote:
 I allready tried 'visibility: visible' and 'display: block' but he
 doesn't hide the picture's. It seems like he totally remove them.
 I don't know what could change that.

 On 16 Sep., 22:16, ricardobeat [EMAIL PROTECTED] wrote:

  ooops.

  yeah, everything disappears on subsequent reloads.

  As Karl said, it looks like an IE rendering bug. When you change any
  of the style properties of an element inside #content, everything goes
  back to normal. Add 'visibility: visible' to your anchors tags and see
  what happens, adjusting the CSS should solve your problem.

  On Sep 16, 4:26 am, weidc [EMAIL PROTECTED] wrote:

   Well for me it still doesn't work. I tried it in IE 6 and 7 with
   windows vista and xp.
   The first time I load the site it works but if I reload it it doesn't.

   On 15 Sep., 20:41, ricardobeat [EMAIL PROTECTED] wrote:

Works ok for me, It's probably your IE install.

On Sep 15, 10:26 am, weidc [EMAIL PROTECTED] wrote:

 I still haven't solved it yet. Does someone got an idea?

 -weidc

 On 11 Sep., 13:49, weidc [EMAIL PROTECTED] wrote:

  Here's the link -http://tinyurl.com/629qpt

  It's really strange. The first 3-5 min it works and after that it
  removes the picture as I said.

  -weidc

  On 10 Sep., 18:12, Karl Swedberg [EMAIL PROTECTED] wrote:

   I'm guessing this has less to do with wrap() than with an IE 
   rendering  
   bug of some sort. If you could provide a link to page that we can 
   look  
   at, that would be helpful. My hunch is that you're dealing with a 
    
   hasLayout issue, but hard to tell if I can't see it.

   --Karl

   
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Sep 10, 2008, at 4:32 AM, weidc wrote:

Hi,

well I got some problems with wrap() and IE. It works fine in 
FireFox
but if I try it in IE it removes every picture beside the one I
clicked. But if I tab in an other register in IE and tab back 
it works
like in FireFox.

I wonder if there is a way to get it work with wrap() or if 
there is
an other way to get it like that.

I hope someone got an idea.

-weidc


[jQuery] Re: jQuery Validation Errors

2008-09-17 Thread GregWa

I apologize, I am incorrect. It has to do with trying to switch the
name attribute on radio buttons in IE. If you do so the plugin will
error. The reason I was trying to change the name attribute is due to
a problem in ASP.Net that will mangle the name when used in things
like repeaters/listviews.

On Sep 17, 10:16 am, GregWa [EMAIL PROTECTED] wrote:
 I figured out the problem.

 In IE, if you have not set a class, even an empty class would suffice
 (class=), it will throw that error. I never saw this in the
 documentation, which I feel could use some work as is to be clearer.
 As such, I am not sure whether this is a known problem or coding
 problem.

 On Sep 15, 5:53 pm, Jörn Zaefferer [EMAIL PROTECTED]
 wrote:

  Please provide a testpage.

  Jörn

  On Mon, Sep 15, 2008 at 4:50 PM, GregWa [EMAIL PROTECTED] wrote:

   In FF3 I am having no issues with the plugin, but in IE (only tested
   7) I am running into the following problem.

  http://i34.tinypic.com/2vnovic.png-Line:662, Error: 'undefined' is
   null or not an object. The offending piece of code goes over to jQuery
   1.2.6 and this is where it errors.

   data: function( elem, name, data ) {
                  elem = elem == window ?
                          windowData :
                          elem;

                  var id = elem[ expando ];

   elem is what is undefined

   Here is the code I'm using to execute the validation:

              validator = $('#form1').validate();
              var input = $('ul.MDProgramsList :input').eq(0);
              input.each(function() { $(this).rules('add', { required:
   true }); });

              valid = validator.form();
              input.rules('remove');

   When I make elem = to windowData it then proceeds to another error.
   I'm not quite sure what is going on to cause this problem in IE.




[jQuery] [validate] Pb with button

2008-09-17 Thread cage31

Hi,

I use the validate plugin for my site but, in my form,  there are some
buttons with metadata. Something like this:
button id=btnCancel class=bnbutton {bnAction:131328}
type=button

1. the plugin control the button element. Why ? Theses are not input.
2. the plugin search the validate function bnAction and hang because
it not exists. What can I do ?

I'll have the same probleme with select tag.

Thanks

Gerard


[jQuery] Re: apples webclip feature in jquery

2008-09-17 Thread Andy Matthews

Could you elaborate? What is this webclip of which you speak? 

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Shafer
Sent: Wednesday, September 17, 2008 11:41 AM
To: jQuery (English)
Subject: [jQuery] apples webclip feature in jquery


I am wanting to write something like apples webclip feature in safari for
jquery, I am trying to figure out where the best place to start is. Does
anyone have any ideas?

Thanks,

-TJ




[jQuery] Re: Image Button Acts Like Submit Button for JQuery Call

2008-09-17 Thread MorningZ

Why not just use plain old img's ??  (and apply 'cursor: pointer' to
them so they appear to be buttons)

Otherwise, in the click event attached to said images, do return
false; at the end and it will stop the form from submitting


[jQuery] What am I doing wrong?

2008-09-17 Thread conspirator

I can't seem to get this to work for a client. I'm not a genious at
jQuery, but I think this is supposed to work. What am I doing wrong?

code
html
head
script type=text/javascript src=some/path/to/js/
jquery-1.2.6.min.js/script
script type=text/javascript src=some/path/to/js/shadowbox/src/
adapter/shadowbox-jquery.js/script
script type=text/javascript src=some/path/to/js/shadowbox/src/
shadowbox.js/script
script type=text/javascript

Shadowbox.loadSkin('classic', 'some/path/to/js/shadowbox/src/skin');
Shadowbox.loadLanguage('en', 'some/path/to/js/shadowbox/src/lang');
Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf',
'wmp'], 'some/path/to/js/shadowbox/src/player');

$(document).ready(function(){
  Shadowbox.init();
});
/script
/head
body
a  rel=shadowbox;height=700px;width=300px class=option
href=http://www.someotherpage.com/other/page;jQuery/a
/body
html
/code


[jQuery] Re: get an image from an input field just with javascript

2008-09-17 Thread tlphipps

You could certainly accomplish this with a little bit of AJAX thrown
in.

Scenario:
- user selects image (using input type='file')
- user clicks 'preview' button
- system submits selected image file via AJAX to server
- server processes image upload and stores file on server
- In the AJAX 'success' handler, create new img tag on page which
references newly stored image file on server.

On Sep 17, 12:04 pm, config [EMAIL PROTECTED] wrote:
 You can't view the file because of security restrictions.

 A *long* time ago one could grab the path and call it with the file://
 protocol, but this is now blocked in most (all?) browsers. Similarly,
 one can't write a path into the file input.

 G.


[jQuery] Re: [validate] Pb with button

2008-09-17 Thread Jörn Zaefferer
The plugin should ignore buttons by default, thats a bug. Could you
create a ticket for this? http://dev.jquery.com/newticket (requires
registration)

Meanwhile, to work around it you can specifx the meta-option to
namespace metadata for validation. Just set meta: validate and the
button should be ignored.

Jörn

On Wed, Sep 17, 2008 at 4:25 PM, cage31 [EMAIL PROTECTED] wrote:

 Hi,

 I use the validate plugin for my site but, in my form,  there are some
 buttons with metadata. Something like this:
 button id=btnCancel class=bnbutton {bnAction:131328}
 type=button

 1. the plugin control the button element. Why ? Theses are not input.
 2. the plugin search the validate function bnAction and hang because
 it not exists. What can I do ?

 I'll have the same probleme with select tag.

 Thanks

 Gerard



[jQuery] Re: Event delegation and accounting for children/descendants

2008-09-17 Thread Matt Kruse

On Sep 15, 1:06 am, hubbs [EMAIL PROTECTED] wrote:
 I was reading a great post on learningjquery.com about event
 delegation, and it gave an example of how to account for child/
 descendants that might get clicked.

See also my recent post to this thread:
http://groups.google.com/group/jquery-en/browse_thread/thread/c39f52b6c5d1feac

This is my way of handling event delegation on elements which may have
child elements that get the actual event.

Matt Kruse



[jQuery] Re: Bind events on DOM elements inserted from other frame

2008-09-17 Thread hubbs

Well, I had this same thing working before.  But it does not solve the
problem of using the parent frames instance of jQuery, which I don't
know how to do.  Using your example inserts the DOM elements, but they
don't get the events, because they don't don't use the parents jQuery,
which is the entire problem.  How can I use the parents instance of
jQuery as you say?

On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote:
 using the iframe's jQuery object:

 $('.classinparentframe', parent.window.document)

 Ideally if the contents of the iframe are always known to you, you
 should use only one instance of jQuery on the parent window and do all
 your stuff from it, it's simpler to debug also.

 On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote:

  Thanks Ricardo.

  But what if I wanted to access the parent document from WITHIN the
  iframe?

  On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote:

   You need to understand that a frame is another 'window' instance, it
   doesn't have the same jQuery object as the parent window unless you
   tell it to. So the '$' object you use in firebug console is always the
   one from the parent window.

   If i'm not mistaken you can acess frame content with the parent
   window's jQuery object using $('.classinsidetheframe',
   frames['name'].document).css();

   On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote:

Ok Brandon,

I found this in another post:

var doc = $('#testframe')[0].contentWindow.document;
$(doc.body).append('spantest/span');

This seems like it would help, but I am not sure how to use this,
along with what you posted to get it working correctly.  Somehow
sending the GET within the context of the contentWindow is confusing
me, and I just can't get it working.

On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote:

 To see what I mean run this in Firebug:
 $('iframe')[0].contentWindow.$ = $;

 Then click on the link in the iframe and it will behave as you expect.

 --
 Brandon Aaron

 On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL 
 PROTECTED]wrote:

  This would work if you used the frames parent instance of jQuery. 
  LiveQuery
  works by monitoring the DOM methods within jQuery. Since within the 
  frame
  you are using a new instance of jQuery, LiveQuery will not be 
  monitoring its
  DOM methods.
  --
  Brandon Aaron

  On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote:

  I can confirm that using event delegation will fix this problem.  I
  guess that it is just a problem with the LiveQuery plugin.  
  Brandon,
  if you are where around here, could you comment on this?

  Thanks.

  On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote:
   I have a working example of this, and would really like help
   understanding why bind or livequery does not bind events to DOM
   elements that are inserted from an iframe.

  http://web2.puc.edu/PUC/files/bind.html

   Clicking the insert from frame link will append links to the 
   parent
   frame, which won't pick up the click event.  But, clicking the 
   insert
   from body link will append links within the same frame and will
   correctly have the click events bound.

   Why is this happening?

   On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote:

I have been experiencing strangeness with trying tobindevents 
to DOM
elements that have been inserted from a different frame using 
.get().
For some reason the elements don't be binded with the events 
if they
are inserted from other frame.  In testing, if I try the same
  thingwithinthe SAME frame the the events get binded correctly.

Am I missing something here?  Is this a limitation of jQuery?


[jQuery] Re: simple if not :checked then show div - BEGINNER

2008-09-17 Thread tlob

can this be done more efficient?
$(document).ready(function(){
$(#auswertung  div).hide();



$(form#form1).submit(function() {
$(#auswertung  div).hide();

$(form#form1 [EMAIL 
PROTECTED]'checkbox']).each(
function()
{
if (!this.checked)
{
var output = this.value;
console.log(output);
$(div#+output).show();
}
});
return false;
});
});

thx


[jQuery] Re: Improvement to delegate plugin to simulate bubbling

2008-09-17 Thread Matt Kruse

On Sep 17, 11:30 am, Nathan Bubna [EMAIL PROTECTED] wrote:
 I like this.  And really, isn't click the only event that you would
 really need this bubbling for?  Couldn't you just check the event type
 and only bubble on click, so that your plugin runs fine with fast-
 firing events too?

Well to begin with, I wouldn't use event delegation for hovers, for
example. It's never been fast enough for my needs. I mainly use it for
click, although I wouldn't want to restrict a solution to only one
event simply because I don't see a need for others.

I could certainly forsee using it for contextmenu and keyboard events,
for example.

Perhaps a better option would be to pass in a flag for whether to
simulate the bubble or not, with it defaulting to true.

I am also experimenting with changing it so rather than using .is(), I
would use .find(), so that more complex selectors that depend on
hierarchy could be used. I'm not sure what impact this would have on
speed.

Matt Kruse



[jQuery] Re: Image Button Acts Like Submit Button for JQuery Call

2008-09-17 Thread tlphipps

I agree with MorningZ that this would be a more appropriate solution.

If you absolutely require these to be input type=image you would
need to attach a click handler (via javascript) to the images that
simply does a 'return false;' so the default action of the buttons
(submitting the form) is ignored.

On Sep 17, 12:58 pm, MorningZ [EMAIL PROTECTED] wrote:
 Why not just use plain old img's ??  (and apply 'cursor: pointer' to
 them so they appear to be buttons)

 Otherwise, in the click event attached to said images, do return
 false; at the end and it will stop the form from submitting


[jQuery] Re: simple if not :checked then show div - BEGINNER

2008-09-17 Thread tlphipps

Seems pretty straightforward to me.  I would recommend one small
syntax change.

1) $(#auswertung  div)  = $(#auswertung div)

and I think you could simplify the each like (NOT TESTED):

 $(#form1 :checkbox).not(':checked').each(
 function()
 {
 var output = this.value;
 console.log(output);
 $(div#+output).show();
 });
 return false;
});

On Sep 17, 1:15 pm, tlob [EMAIL PROTECTED] wrote:
 can this be done more efficient?
 $(document).ready(function(){
                         $(#auswertung  div).hide();

                         $(form#form1).submit(function() {
                                 $(#auswertung  div).hide();

                                 $(form#form1 [EMAIL 
 PROTECTED]'checkbox']).each(
                                     function()
                                     {
                                         if (!this.checked)
                                         {
                                             var output = this.value;
                                             console.log(output);
                                             $(div#+output).show();
                                         }
                                     });
                                 return false;
                         });
         });

 thx


[jQuery] Re: Jcrop v0.9.0 image cropping plugin - comments please

2008-09-17 Thread Richard D. Worth
On Wed, Sep 17, 2008 at 10:37 AM, Kelly [EMAIL PROTECTED] wrote:


 Thanks Richard W. And thanks to everyone who has commented.
 I am glad that most of the issues raised have been purely
 philosophical. :)

 Jose, please use whatever plugin you feel is best suited for you
 needs.
 The whole purpose of a plugin is you don't need to worry about what's
 inside.
 If you have a conviction that you want to use jQuery UI somewhere,
 please do.


Both good points.



 I've seen that jQuery UI-based cropping demo and frankly it's broken.
 I don't think that's jQuery UI's fault, but it does not make a very
 compelling demo.
 Nor does the demo include documentation, downloads, or anything else I
 can see.


Agreed. Though I didn't author that demo, I've been meaning to fix it up for
some time. Seeing what you've done has re-inspired me.



 Surely jQuery UI could have been used, but I was not/am not familiar
 enough with it.
 Therefore, I cannot comment if it would actually benefit more than my
 coding time.
 I also wanted to minimize the codebase and dependencies.

 I do plan to experiment with the UI libraries. If they prove
 beneficial, a future release may use it.
 Or, I may incorporate some of UI's optimizations in my own code, if
 applicable.


Either way, :-)



 As with the naming (e.g. Jcrop vs. jCrop), these are issues I
 considered a lot.
 It's very possible that I made some wrong choices.

 This is the first time I've ever seen lack of a dependency as a
 detriment to someone.


If someone is already using jQuery UI it's a bit reversed, as the
duplication/dependence on additional code would be coming from your plugin,
not the other way around. Of course it goes further than just code size. Not
to say there's no place for Jcrop. There will always be a place for
stand-alone plugins. But jQuery UI could really benefit from having
available such a stellar image crop plugin as well.

I'll take a crack at merging some bits of what you've done with what jQuery
UI has. We'll see where it lands us. As I said, I'd been meaning to do
something like this anyway, and you've done a lot of really great and hard
work. So, thanks :)

- Richard


[jQuery] Re: simple if not :checked then show div - BEGINNER

2008-09-17 Thread Richard D. Worth
Also not tested:

$(#form1 :checkbox:not(:checked)).each(

- Richard

On Wed, Sep 17, 2008 at 2:44 PM, tlphipps [EMAIL PROTECTED]wrote:


 Seems pretty straightforward to me.  I would recommend one small
 syntax change.

 1) $(#auswertung  div)  = $(#auswertung div)

 and I think you could simplify the each like (NOT TESTED):

  $(#form1 :checkbox).not(':checked').each(
 function()
  {
 var output = this.value;
 console.log(output);
 $(div#+output).show();
 });
 return false;
 });

 On Sep 17, 1:15 pm, tlob [EMAIL PROTECTED] wrote:
  can this be done more efficient?
  $(document).ready(function(){
  $(#auswertung  div).hide();
 
  $(form#form1).submit(function() {
  $(#auswertung  div).hide();
 
  $(form#form1
 [EMAIL PROTECTED]'checkbox']).each(
  function()
  {
  if (!this.checked)
  {
  var output = this.value;
  console.log(output);
  $(div#+output).show();
  }
  });
  return false;
  });
  });
 
  thx



[jQuery] Re: simple if not :checked then show div - BEGINNER

2008-09-17 Thread tlphipps
Well, what do you know!  I always wondered why the :not syntax wasn't
included in the selector engine.  I always thought it had to be
separated in the chain.

Thanks Richard for providing this example!!

On Sep 17, 1:52 pm, Richard D. Worth [EMAIL PROTECTED] wrote:
 Also not tested:

 $(#form1 :checkbox:not(:checked)).each(

 - Richard

 On Wed, Sep 17, 2008 at 2:44 PM, tlphipps [EMAIL PROTECTED]wrote:



  Seems pretty straightforward to me.  I would recommend one small
  syntax change.

  1) $(#auswertung  div)  = $(#auswertung div)

  and I think you could simplify the each like (NOT TESTED):

   $(#form1 :checkbox).not(':checked').each(
                                      function()
                                       {
                                              var output = this.value;
                                              console.log(output);
                                              $(div#+output).show();
                                      });
                                  return false;
  });

  On Sep 17, 1:15 pm, tlob [EMAIL PROTECTED] wrote:
   can this be done more efficient?
   $(document).ready(function(){
                           $(#auswertung  div).hide();

                           $(form#form1).submit(function() {
                                   $(#auswertung  div).hide();

                                   $(form#form1
  [EMAIL PROTECTED]'checkbox']).each(
                                       function()
                                       {
                                           if (!this.checked)
                                           {
                                               var output = this.value;
                                               console.log(output);
                                               $(div#+output).show();
                                           }
                                       });
                                   return false;
                           });
           });

   thx

[jQuery] Re: Bind events on DOM elements inserted from other frame

2008-09-17 Thread hubbs

Ok, I have the following in my iframe:

$(document).ready(function() {
$ = window.parent.$;
$(#test).click(function() {
$(#hold).append('a href=#Inserted from iFrame/a
br /');
});
});

This seems to be what I would need, but now it won't load content into
the parent...arg.

On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote:
 using the iframe's jQuery object:

 $('.classinparentframe', parent.window.document)

 Ideally if the contents of the iframe are always known to you, you
 should use only one instance of jQuery on the parent window and do all
 your stuff from it, it's simpler to debug also.

 On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote:

  Thanks Ricardo.

  But what if I wanted to access the parent document from WITHIN the
  iframe?

  On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote:

   You need to understand that a frame is another 'window' instance, it
   doesn't have the same jQuery object as the parent window unless you
   tell it to. So the '$' object you use in firebug console is always the
   one from the parent window.

   If i'm not mistaken you can acess frame content with the parent
   window's jQuery object using $('.classinsidetheframe',
   frames['name'].document).css();

   On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote:

Ok Brandon,

I found this in another post:

var doc = $('#testframe')[0].contentWindow.document;
$(doc.body).append('spantest/span');

This seems like it would help, but I am not sure how to use this,
along with what you posted to get it working correctly.  Somehow
sending the GET within the context of the contentWindow is confusing
me, and I just can't get it working.

On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote:

 To see what I mean run this in Firebug:
 $('iframe')[0].contentWindow.$ = $;

 Then click on the link in the iframe and it will behave as you expect.

 --
 Brandon Aaron

 On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL 
 PROTECTED]wrote:

  This would work if you used the frames parent instance of jQuery. 
  LiveQuery
  works by monitoring the DOM methods within jQuery. Since within the 
  frame
  you are using a new instance of jQuery, LiveQuery will not be 
  monitoring its
  DOM methods.
  --
  Brandon Aaron

  On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote:

  I can confirm that using event delegation will fix this problem.  I
  guess that it is just a problem with the LiveQuery plugin.  
  Brandon,
  if you are where around here, could you comment on this?

  Thanks.

  On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote:
   I have a working example of this, and would really like help
   understanding why bind or livequery does not bind events to DOM
   elements that are inserted from an iframe.

  http://web2.puc.edu/PUC/files/bind.html

   Clicking the insert from frame link will append links to the 
   parent
   frame, which won't pick up the click event.  But, clicking the 
   insert
   from body link will append links within the same frame and will
   correctly have the click events bound.

   Why is this happening?

   On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote:

I have been experiencing strangeness with trying tobindevents 
to DOM
elements that have been inserted from a different frame using 
.get().
For some reason the elements don't be binded with the events 
if they
are inserted from other frame.  In testing, if I try the same
  thingwithinthe SAME frame the the events get binded correctly.

Am I missing something here?  Is this a limitation of jQuery?


[jQuery] Image Button Acts Like Submit Button for JQuery Call

2008-09-17 Thread rcflyer2005

On my web page, I have two image button to dynamically add or delete a
row of data in a table.  When I click the buttons, they submit the
form and execute the action=justDoIt.php  on the form tag and not
call jquery.  Is there any way this can be fixed.  I'm using IE6  8
beta.  I have to stick with IE for now because I have vbs.

Thanks loads!
Marv.

These two buttons work, but are very ugly:

 input type=button value=del class=delrow/ --
 input type=button value=add class=addrow id=addrow/


I would like to get these two buttons to work:
divtd
input type=image  class=delrow src=images/rowOutDel.png
  onmouseout= this.src=images/rowOutDel.png
  onmouseover=this.src=images/rowOverDel.png
  onmousedown=this.src=images/rowDownDel.png  /

input type=image  class=addrow src=images/rowOutAdd.png
  onmouseout= this.src=images/rowOutAdd.png
  onmouseover=this.src=images/rowOverAdd.png
  onmousedown=this.src=images/rowDownAdd.png /

 /td/div


[jQuery] Re: jquery/livequery assign behaviour to element by class

2008-09-17 Thread onmountain

Hi Brandon,
I tried to do that, but it breaks the ajax effect - clicking submit
just does an HTML post to the server php program:
$('.deleteform').livequery('submit', function() {
//$('.deleteform').submit(function() {
var gthis = this;
var delformData = $(this).serialize();
//function() {echo hello; }
$.post('eatchoices.php', delformData, delprocessData);
function delprocessData(data) {
$(gthis).parent().html(data);  // get the parent of the form
so replace just below the date
}  // end of delformData
return false;
}); // end of submit delete form

I am stumped and confused,
Jamie


On Sep 16, 10:03 pm, Brandon Aaron [EMAIL PROTECTED] wrote:
 Replace the first line
 $('.deleteform').submit(function() {

 with this

 $('.deleteform').livequery('submit', function() {

 --
 Brandon Aaron

 On Tue, Sep 16, 2008 at 8:30 PM, onmountain [EMAIL PROTECTED] wrote:

  Can I use livequery with ajax?  For instance, I am adding and deleting
  elements of a certain class that have .post associated with them
  at .ready.

  For instance, if my last .post returns new html that create more items
  with delete forms, how should I turn the code in the .ready below to
  work?
         $('.deleteform').submit(function() {
                 var gthis = this;
                 var delformData = $(this).serialize();
                 $.post('eatchoices.php', delformData, delprocessData);
                 function delprocessData(data) {
                         $(gthis).parent().html(data);  // get the parent of
  the form so replace just below the date
                 }  // end of delformData
             return false;
         }); // end of submit delete form

  On Sep 15, 4:11 pm, Brandon Aaron [EMAIL PROTECTED] wrote:
   Typically with tables you want to do event delegation for performance
   reasons. However, this is how you'd do it with LiveQuery.
   $(document).ready(function() {
       $('table tbody td.hasContent')
           .livequery('mouseenter', showBox)
           .livequery('mouseleave', hideBox)
           .livequery('mousemove', position)
           .livequery('click', showDetail);

   });

   You could also do a function based livequery like this:

   $(document).ready(function() {
       $('table tbody td.hasContent')
           .livequery(function() {
               $(this)
                   .bind('mouseenter', showBox)
                   .bind('mouseleave', hideBox)
                   .bind('mousemove', position)
                   .bind('click', showDetail);
           });

   });

   The mouseenter and mouseleave events are what the hover helper method use
   behind the scenes.

   --
   Brandon Aaron

   On Mon, Sep 15, 2008 at 11:49 AM, jwynne [EMAIL PROTECTED] wrote:

Currently I am using $(document).ready to bind some behaviours to
  elements
in
the DOM based on a class name (using jquery's .filter) - This works
  great
on
the initial load of the page however these bindings get all screwy when
  I
try injecting or editing new elements to the DOM dynamically via AJAX.
After researching the issue I have been trying to use the livequery
  plug-in
but have been unsuccessful so far.

In $(document).ready I am assigning behaviour to td elements of the
  class
hasContent. I am looking to hook them up to livequery listeners so
  that
the correct behaviours are assigned when the DOM is updated.

$(document).ready(function(event) {

       var position = function() {
               }
       var showBox = function() {
               }
       var hideBox = function() {
               }
       var showDetail = function() {
               }

       //Syntax help below
       $(table tbody td).filter(.hasContent).hover(showBox,
hideBox).mousemove(position);
       $(table tbody td).filter(.hasContent).click(showDetail);

});//EOF

Can anybody help me with the syntax necessary to get livequery to
bind/unbind the necessary behaviours to the table tds?

Thanks for the help.
--
View this message in context:
   http://www.nabble.com/jquery-livequery-assign-behaviour-to-element-by.
  ..
Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.


[jQuery] Superfish navbar for Wordpress

2008-09-17 Thread kiper

Hi there!

First, I just want to say thank you for Superfish that is a truly
great navigation component (maybe THEgreatest)!

I have integrated Superfish with Wordpress and it works really smooth.
But when I made a design with a navbar and tried to find a working
solution I just failed. Superfish is working to 90% but it will not
keep the current submenu open if only the main menu level item is
selected. The reason for this is that Wordpress uses two (three)
different 'current' classes: 'current_page_item' ,
'current_page_ancestor' and 'current_page_parent'. The last two are
interchangeable.
The problem arises because pathClass can only have one 'current'
class.
If you choose 'current_page_item' as the 'current' class you will have
a menu that is working as it should until you click on a submenu item.
This will make the submenu disappear.
If you choose 'current_page_ancestor' or 'current_page_parent' as the
'current' class you get the opposite problem:
If you only have a main menu item selected then you will not see the
submenu unless you hover over the main menu tabs but if you select a
submenu item the submenu is visible as it should be.

Now, it is possible to solve this by removing Wordpress superfluos
classes and just keep one: 'current_page_item'.
But this becomes a problem when you create sites for clients that
updates their wordpress installations by themselves. When they
overwrite the old files they will get the problem again!

So, is there another way to solve this? Is it possible to give
pathClass several 'current' classes? Is there anyone out there with a
navbar solution for Wordpress?

Would truly appreciate an answer to this!

Sincerely,

Müfit Kiper


[jQuery] Re: Image Button Acts Like Submit Button for JQuery Call

2008-09-17 Thread rcflyer2005



On Sep 17, 1:39 pm, rcflyer2005 [EMAIL PROTECTED] wrote:
 There are two image buttons on my web page that are intended to
 execute javascript jquery.  However, they trigger the php program on
 the form tag action=justDoIt.php.  Is there a way to fix this so
 my buttons trigger jquery or an alternative solution?

 These two button do not work, they trigger submit:

         input type=image  class=delrow src=images/rowOutDel.png
           onmouseout= this.src=images/rowOutDel.png
           onmouseover=this.src=images/rowOverDel.png
                   onmousedown=this.src=images/rowDownDel.png  /

     input type=image  class=addrow src=images/rowOutAdd.png
                   onmouseout= this.src=images/rowOutAdd.png
                   onmouseover=this.src=images/rowOverAdd.png
                   onmousedown=this.src=images/rowDownAdd.png /

 These buttons work and trigger javascript-jquery (but are quite ugly):
    input type=button value=del class=delrow/
    input type=button value=add class=addrow id=addrow/

 Thanks loads.

Sorry if this is a double post.  My first time here...  Thanks.


[jQuery] Re: Jcrop v0.9.0 image cropping plugin - comments please

2008-09-17 Thread Sam Sherlock
Please forgive me if this has been raised before (I may have missed it)  but
do either of these plugins have a contrained aspect ratio feature

2008/9/17 Richard D. Worth [EMAIL PROTECTED]


 On Wed, Sep 17, 2008 at 10:37 AM, Kelly [EMAIL PROTECTED] wrote:


 Thanks Richard W. And thanks to everyone who has commented.
 I am glad that most of the issues raised have been purely
 philosophical. :)

 Jose, please use whatever plugin you feel is best suited for you
 needs.
 The whole purpose of a plugin is you don't need to worry about what's
 inside.
 If you have a conviction that you want to use jQuery UI somewhere,
 please do.


 Both good points.



 I've seen that jQuery UI-based cropping demo and frankly it's broken.
 I don't think that's jQuery UI's fault, but it does not make a very
 compelling demo.
 Nor does the demo include documentation, downloads, or anything else I
 can see.


 Agreed. Though I didn't author that demo, I've been meaning to fix it up
 for some time. Seeing what you've done has re-inspired me.



 Surely jQuery UI could have been used, but I was not/am not familiar
 enough with it.
 Therefore, I cannot comment if it would actually benefit more than my
 coding time.
 I also wanted to minimize the codebase and dependencies.

 I do plan to experiment with the UI libraries. If they prove
 beneficial, a future release may use it.
 Or, I may incorporate some of UI's optimizations in my own code, if
 applicable.


 Either way, :-)



 As with the naming (e.g. Jcrop vs. jCrop), these are issues I
 considered a lot.
 It's very possible that I made some wrong choices.

 This is the first time I've ever seen lack of a dependency as a
 detriment to someone.


 If someone is already using jQuery UI it's a bit reversed, as the
 duplication/dependence on additional code would be coming from your plugin,
 not the other way around. Of course it goes further than just code size. Not
 to say there's no place for Jcrop. There will always be a place for
 stand-alone plugins. But jQuery UI could really benefit from having
 available such a stellar image crop plugin as well.

 I'll take a crack at merging some bits of what you've done with what jQuery
 UI has. We'll see where it lands us. As I said, I'd been meaning to do
 something like this anyway, and you've done a lot of really great and hard
 work. So, thanks :)

 - Richard




[jQuery] Re: Event delegation and accounting for children/descendants

2008-09-17 Thread Karl Swedberg

Hi hubbs,

1. If you want to throw an alert, you could do it like this:

$(document).ready(function() {
 $('table').click(function(event) {
   var $thisCell, $tgt = $(event.target);
   if ($tgt.is('td')) {
 $thisCell = $tgt;
   } else if ($tgt.parents('td').length) {
 $thisCell = $tgt.parents('td:first');
   }
   // now do something with $thisCell
if ($thisCell) {
alert('hello');
}
 });
});

Definitely take a look at Matt's post, though. It's a more robust  
solution.


2. The ':first' selector is there in case you have nested tables.  
It'll select the one closest to event.target.


3. If you don't want anything to occur when clicking on a link's  
nested spans, then you don't have to check for parents or anything  
like that. It's much easier. Is it all links in the document? All  
links in a table? Anyway, you could do something like this:


$('table').click(function(event) {
  if (event.target.nodeName.toLowerCase() === 'a') {
event.preventDefault();
// do something
  }
});



--Karl


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




On Sep 15, 2008, at 2:06 AM, hubbs wrote:



I was reading a great post on learningjquery.com about event
delegation, and it gave an example of how to account for child/
descendants that might get clicked.

Here is the example show:

$(document).ready(function() {
 $('table').click(function(event) {
   var $thisCell, $tgt = $(event.target);
   if ($tgt.is('td')) {
 $thisCell = $tgt;
   } else if ($tgt.parents('td').length) {
 $thisCell = $tgt.parents('td:first');
   }
   // now do something with $thisCell
 });
});

My question is, how do I do something with $thisCell?  I must be
missing a step here, what is I wanted it to throw an alert?
Also, what is the :first doing in this situation?  Say, I have a link
that has a few nested spans inside, how could I ignore the clicks on
those spans, and only register it as a click on the anchor?




[jQuery] can i use livequery with greybox2 or equivalent?

2008-09-17 Thread onmountain

Hi. I am using greybox2 plugin to generate a modal window with details
of items when I click on their hyperlink, identified by the class=   .
However, I am also adding more such hyperlinks with teh same class=
on the fly, and I need to rebind the elements correctly. Can I use
livequery to do this, or do I need to do it another way?

This is what my code looks like:

  $(document).ready(
function(){
  var gbOptions = {
gbWidth: 400,
gbHeight: 400,
captionHeight: 22
  };

  $('.pageWindow').greybox(gbOptions); // for item info opening in
modal wondow

blah blah blah

---

Can I use livequery like something like this ( This doesn't work)?:



  $('.pageWindow').livequery('click',
  $('.pageWindow').greybox(gbOptions); )  // for item info
opening in modal wondow
  });

-

Thanks,
Jamie



[jQuery] Re: How to serialize an Object to JSON String without making it POST like?

2008-09-17 Thread Mike Alsup

 So I need to write my own JSON serializer or is there something
 already available?

 If I do need to write my own, how can I contribute it back to the
 community?

I consider this the defacto standard:

http://www.json.org/json2.js

And IE8's native JSON API is exactly the same as the one in json2.js.

Mike


[jQuery] Re: Hover on all elements: $(*).hover(...)

2008-09-17 Thread Karl Swedberg

This one worked for me...

$('body').bind('mouseover', function(event) {
  $(event.target).addClass('selected');
}).bind('mouseout', function(event) {
  $(event.target).removeClass('selected');
});

You'll run into problems if you have properties assigned to more  
specific selectors in your stylesheet, but otherwise, it should work  
fine.


--Karl


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




On Sep 17, 2008, at 9:50 AM, benjam wrote:



This is insanely kludgy, not very pretty, and probably slower than a
more elegant solution.

But it works.

$('*').hover(
function(event) {
var $this = $(this);
$this.addClass('selected');
$this.parents( ).removeClass('selected');
},
function(event) {
var $this = $(this);
$this.removeClass('selected');
$this.parents( ).removeClass('selected');
$this.parent( ).addClass('selected');
$this.children( ).removeClass('selected');
}
);

I'm sure there are better solutions out there, but this was the
fastest and easiest method.

On Sep 17, 2:04 am, Balazs Endresz [EMAIL PROTECTED] wrote:

I'm not sure I get it, but if you want to grab the strong inside a
p when the event is only bound to p then you can get it simply by
event.target:

$('body').find('*').filter(function(){
  return !$(this).children().length;})

.add('p').not('p *')
.hover(function(event){

var t=event.target  //this will be the strong tag inside the p

if ($(this).children().length()  0) {
   return False
}

$(this).addClass('selected');
  },
  function(){
 $(this).removeClass('selected');
  }
);

You can also try this with event delegation, which will be much  
faster

with a lot of 
elements:http://dev.distilldesign.com/log/2008/jan/27/event-delegation-jquery/http://lab.distilldesign.com/event-delegation/

On Sep 16, 7:17 pm, John Boxall [EMAIL PROTECTED] wrote:


Hi Balazs,



Thanks for the reply - looking at your suggestion, my idea was to
apply it to the code like this:



$(function() {
$(*).hover(
   function(){



// If the element has more than one child stop
propagating.
if ($(this).children().length()  0) {
return False
}



$(this).addClass('selected');
},
function(){
$(this).removeClass('selected');
}
);



}



This is _close_ to what I want, but what I'd really like is to grab
DOM element you are hovering over with the minimum number of  
children

- not necessarily zero.



It's my understanding that with the above, if you hovered over a p
with a strong inside you couldn't select the p because it would
have a child!



Thanks,



John



Should only return true if the selected $(this) has no children.
This is _close_ to what I want - but what I'd really like is to grab
the element



On Sep 14, 4:10 am, Balazs Endresz [EMAIL PROTECTED] wrote:



Hey John,



I think this will do that:



$('body').find('*').filter(function(){
  return !$(this).children().length;})


.add('p').not('p *') //without this, if a paragraph contains tags  
thehoverwon't be applied to the most of the text



On Sep 12, 9:29 pm, John Boxall [EMAIL PROTECTED] wrote:



Heyo jQuery hackers,


I'm putting together a little script that adds a class  
selected to

an element when youhoverover it.
When you stop hovering the class selected class is removed.


I would like the class only to be apply to the lowest element in  
the

DOM.


For example say I was hovering over a p deep inside a document  
- I
would like to only add the class selected to that p tag, not  
the

div, body and html tags surrounding it.



So far my thinking has been to use something like this:



$(function() {
$(*).hover(
   function(){
$(this).addClass('selected');
},
function(){
$(this).removeClass('selected');
}
);



}



Which adds the selected class to any element Ihoverover fine. It
also removes it.



The problem is thehoveris firing all the way up the chain and
hitting all elements from the lowest to the highest so I've got  
a ton
of ugly selected elements when I really just wanted the lowest  
one...



Is there any way I can restrict it?



Thanks,



John




[jQuery] Re: How to serialize an Object to JSON String without making it POST like?

2008-09-17 Thread MorningZ

So I need to write my own JSON serializer or is there something
already available?

it's not all that involved

var FormValues = {};
$(:input).each(function() {
  FormValues[$(this).attr(name)] = $(this).val();
});

Something along those lines anyways


[jQuery] Re: input box on change event?

2008-09-17 Thread bombaru

Thanks Alex...

Currently, the button appears when focus is on the input box and
disappears when focus is removed from the input box.  I want to keep
this behavior if no change has occurred in the input box itself (in
this case quantity) and keep the button visible if there has been
any change.  I guess what I need to figure out is how to keep the blur
function but have two arguments inside of it (one for change and one
for no change).  The no change would work as it currently does... and
the change would essentially do nothing (meaning keep the button
visible to the user).  Does this make any sense?  Any ideas?

Thanks again.

Russ



On Sep 16, 11:49 pm, Alex Weber [EMAIL PROTECTED] wrote:
 I'm not sure I understand exactly what you mean but I can answer the
 question in the title of your thread :)

 instead of using the 'blur' event use the 'change' jquery event
 (analogous to onChange() traditional js)

 http://docs.jquery.com/Events/change

 -Alex

 On Sep 16, 11:08 pm, bombaru [EMAIL PROTECTED] wrote:

  I've got an input box and am displaying a form button on focus... then
  hiding the form button on blur.  Ideally, I want to display the form
  button on focus, but only hide the button if the original contents of
  the input box have not changed (put another way... persist the form
  button if the quantity has changed).  Can someone help steer me in the
  right direction?  This is for a cart checkout page that I am working
  on and will provide users a way to update the quantity of an item in
  their cart.  Here's the code I am using:

  // flag the document as OK for JS
  $('html').removeClass('nojs');

  //show Update buttons only as necessary
  $('input.qty').each(function()
  {
  var $qButton = $
  (this).siblings('[EMAIL PROTECTED]image]');

  $(this).focus(function()
  {
  $qButton.fadeIn(200);
  });

  $(this).blur(function()
  {
  $qButton.fadeOut(200);
  });
  });

  As you can probably tell, this approach is less than ideal and
  provides the user no time to click the update button after a change
  has been made.  I can increase the fadeOut duration, but that still
  blows.

  Thanks for any help you might be able to provide me.


[jQuery] jQuery and iPhone developers... effects working yet?

2008-09-17 Thread somedude

I have read through a few other posts and blog entries on getting
jQuery to function properly (effects) on the iPhone. I tried a few
libraries to help develop on the iphone but I keep returning to my
beloved jQuery. Everything else is lines and lines of code while
jQuery can do it in a single line.

The only thing that doesn't work properly is the effects. Sliding,
animating and other effects do not emulate properly on the iPhones
safari browser. I did some reading and it seems that the interval in
jQuery is 20ms where as it should be atleast 80 to function properly
on the iphone's browser.

Has anyone out there got the effects in jQuery or jQuery UI to
function smoothly?.

Thanks


[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread John Resig

I wasn't counting the hits to code.jquery.com in those numbers -
that's another 20 million-or-so hits per month (and are stored on a
separate server).

--John



On Wed, Sep 17, 2008 at 1:34 PM, acacio [EMAIL PROTECTED] wrote:

 I had the same problem so I switched to the Google hosted files and
 it's *much* faster.
 Also, if we use it systematically, the client browser caches the files
 between different apps.

 You need to replace the load to this:

  script src=http://www.google.com/jsapi;/script
  script
// Load jQuery
google.load(jquery, 1.2);
google.load(jqueryui, 1.5);
  /script

 Nothing else needs to be changed.

 A good article on the subject:
 http://ajaxian.com/archives/announcing-ajax-libraries-api-speed-up-your-ajax-apps-with-googles-infrastructure

 -Acacio

 On Sep 17, 7:05 pm, John Resig [EMAIL PROTECTED] wrote:
 We just acquired four new servers from Media Temple, yesterday. We'll
 be moving the various sub-domains (docs, plugins, dev, ui) to their
 own unique servers this week - this should help with load times
 significantly.

 But yes, it's mostly due to popularity issues (we're getting the
 equivalent of about 4 Digg/Slashdot-ings worth of traffic, per day, at
 this point).

 On 9/17/08, misterqj [EMAIL PROTECTED] wrote:





  I have experienced the same thing. Based on other messages in this
  newsgroup, I think it is a combo of hosting issues and jQuery's
  popularity. On one hand, it is great that the toolkit is being so
  widely used, but on the other hand it seems that the resources aren't
  keeping up with demand.

  It is a free toolkit, though, so I am not inclined to complain too
  much. But if they need additional resources, it might be time for the
  community to kick in a little $$.

  On Sep 17, 7:30 am, micha_17 [EMAIL PROTECTED] wrote:
  Can someone please confirm that jquery.com is sometimes (%2) so slow,
  pages won't even show up after 2 minutes waiting ? The slowness has
  been there before tha page has been redesigned.

  I'm on winxp FF3. I's the same with my colleagues here and @home.

 --
 --John



[jQuery] Re: jquery.com incredibly slow for me

2008-09-17 Thread MorningZ

(Sorry to veer off topic for a bit)

I've seen this posted before, and i just tried it..

html xmlns=http://www.w3.org/1999/xhtml;
head
titleLoad from Google/title
script type=text/javascript src=http://www.google.com/jsapi;/
script
script type=text/javascript
google.load(jquery, 1.2);
google.load(jqueryui, 1.5);
$(document).ready(function() {

});
/script
/head
body


/body
/html



And that throws $ is undefined...  although through Firebug i
clearly see the jquery file(s) loaded

any ideas?





On Sep 17, 1:34 pm, acacio [EMAIL PROTECTED] wrote:
 I had the same problem so I switched to the Google hosted files and
 it's *much* faster.
 Also, if we use it systematically, the client browser caches the files
 between different apps.

 You need to replace the load to this:

   script src=http://www.google.com/jsapi;/script
   script
     // Load jQuery
     google.load(jquery, 1.2);
     google.load(jqueryui, 1.5);
   /script

 Nothing else needs to be changed.

 A good article on the 
 subject:http://ajaxian.com/archives/announcing-ajax-libraries-api-speed-up-yo...

 -Acacio

 On Sep 17, 7:05 pm, John Resig [EMAIL PROTECTED] wrote:

  We just acquired four new servers from Media Temple, yesterday. We'll
  be moving the various sub-domains (docs, plugins, dev, ui) to their
  own unique servers this week - this should help with load times
  significantly.

  But yes, it's mostly due to popularity issues (we're getting the
  equivalent of about 4 Digg/Slashdot-ings worth of traffic, per day, at
  this point).

  On 9/17/08, misterqj [EMAIL PROTECTED] wrote:

   I have experienced the same thing. Based on other messages in this
   newsgroup, I think it is a combo of hosting issues and jQuery's
   popularity. On one hand, it is great that the toolkit is being so
   widely used, but on the other hand it seems that the resources aren't
   keeping up with demand.

   It is a free toolkit, though, so I am not inclined to complain too
   much. But if they need additional resources, it might be time for the
   community to kick in a little $$.

   On Sep 17, 7:30 am, micha_17 [EMAIL PROTECTED] wrote:
   Can someone please confirm that jquery.com is sometimes (%2) so slow,
   pages won't even show up after 2 minutes waiting ? The slowness has
   been there before tha page has been redesigned.

   I'm on winxp FF3. I's the same with my colleagues here and @home.

  --
  --John


[jQuery] Re: input box on change event?

2008-09-17 Thread MorningZ

Well, to back up Alex's post, the change event fires when the
textbox's value, uhhh, *changes*

so if you don't want the button to show up if the user goes into the
box and goes out without changes, and *does* show if the user goes in
and changes a value, then this is the event you want

blur makes no sense in this situation


[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Karl Rudd

Err remove() is chainable. It doesn't return a DOM element, it
keeps hold of the elements that it was called to remove from the
DOM. So it acts just like replaceWith().

There was a debate in the early stages of jQuery about whether or not
methods (not including the base $/jQuery function) that created new
objects should select those objects. As can be seen by the current
state of things, it was decided against.

Karl Rudd

On Wed, Sep 17, 2008 at 9:04 PM, Richard D. Worth [EMAIL PROTECTED] wrote:

 On Wed, Sep 17, 2008 at 6:58 AM, Karl Rudd [EMAIL PROTECTED] wrote:

 Nah, it's not a bug.

 replaceWith( content )  Returns: jQuery
 Replaces all matched elements with the specified HTML or DOM elements.
 This returns the JQuery element that was just replaced, which has been
 removed from the DOM

 ( http://docs.jquery.com/Manipulation )

 It may be well documented, but that doesn't mean it can't be a bug. ;)


 It's like doing a remove(), followed by an append(). Like remove()
 it also returns (well keeps in the jQuery collection) the elements
 it removes.

 This is quite a fundamental difference. Since .remove() returns a DOM
 Element, it's not chainable. Since replaceWith() returns a chainable jQuery
 object, it's reasonable to expect methods you call on that chain to effect
 the new element, not your now removed/disconnected element(s). Like many
 other methods, it could modify the chain. And if you wanted to get back to
 the previous chain, you could call .end(). My 2c.

 - Richard



[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Ariel Flesler

I think this is a bug, I'd expect replaceWith to return the old set,
just like append/etc.

Can you (tchvil) file a bug with a test case ? put it under core,
assigned to me.

Thanks
--
Ariel Flesler
http://flesler.blogspot.com/

On Sep 17, 8:04 am, Richard D. Worth [EMAIL PROTECTED] wrote:
 On Wed, Sep 17, 2008 at 6:58 AM, Karl Rudd [EMAIL PROTECTED] wrote:

  Nah, it's not a bug.

  replaceWith( content )  Returns: jQuery
  Replaces all matched elements with the specified HTML or DOM elements.
  This returns the JQuery element that was just replaced, which has been
  removed from the DOM

  (http://docs.jquery.com/Manipulation)

 It may be well documented, but that doesn't mean it can't be a bug. ;)



  It's like doing a remove(), followed by an append(). Like remove()
  it also returns (well keeps in the jQuery collection) the elements
  it removes.

 This is quite a fundamental difference. Since .remove() returns a DOM
 Element, it's not chainable. Since replaceWith() returns a chainable jQuery
 object, it's reasonable to expect methods you call on that chain to effect
 the new element, not your now removed/disconnected element(s). Like many
 other methods, it could modify the chain. And if you wanted to get back to
 the previous chain, you could call .end(). My 2c.

 - Richard


[jQuery] Re: cascade question

2008-09-17 Thread ricardobeat

You can do it via XHTML:

option value=B selected=selectedB/option

or add the attribute with jQuery:

$('#first option:eq(2)').attr('selected','selected');

ricardo

On Sep 17, 10:50 am, kevin [EMAIL PROTECTED] wrote:
 Hi all,

 here is my sample page  http://sskes.damimi.org/test/

 my question is how can i let the first box selected on B and also
 trigger second box list the correct value
 B1,B2,B3,B4 automatically when page loaded.

 thanks.


[jQuery] Re: getting/setting height() in IE6 quirks mode behaves inconsistently

2008-09-17 Thread ricardobeat

There is a reason it's called Quirks mode :)

On Sep 17, 2:26 pm, Matt Kruse [EMAIL PROTECTED] wrote:
 In IE6, quirks mode, I expect this to not change their height of an
 object:

 var h = $obj.height();
 $obj.height(h);

 However, it does cause a re-size (if the object has padding/borders).
 Is this intended?
 ( Using:http://code.jquery.com/jquery-latest.pack.js)

 It looks like when height() is called, it returns the internal height,
 minus borders and padding.
 When height(val) is called, the height includes borders and padding.

 I believe these should behave consistently in quirks mode. In
 standards mode they work fine.

 For now I will write a fix that switches based on compatMode.

 Matt Kruse


[jQuery] Re: nth-child(n) not working for me - I didn't see my previous post

2008-09-17 Thread ricardobeat

You're not really referencing the 'n' variable you just defined, as
you're passing a string.

var n = 2;
$(#filterTable tbody tr td:nth-child(+n+)).each(function(){


On Sep 17, 2:24 pm, kcharles [EMAIL PROTECTED] wrote:
 I switch between var n = 2; nth-child(n) and nth-child(2) and get
 different behavior.
 Any suggestions/work arounds?
 Thanks!

 Here is the code:

 html
 head
 titlenth child/title
 script type=text/javascript src=jquery.js/script
 script type=text/javascript
 //Add input box for each column

 $(function(){
          var n = 2;
 //       $(#filterTable tbody tr td:nth-child(2)).each(function(){
          $(#filterTable tbody tr td:nth-child(n)).each(function(){
                  $(this).append(this row);
          });

 });

 /script
 /head
 body

 table id=filterTable  width=580 border=1
 thead
 tr
 thNumber/th
 thLetter/th
 thMore/th
 /tr
 /thead

 tbody
 tr
 td1/td
 tdA/td
 tdA/td
 /tr

 tr
 td2/td
 tdA/td
 tdB/td
 /tr

 tr
 td3/td
 tdB/td
 td3/td
 /tr

 tr
 td4/td
 tdB/td
 tdD/td

 /tr
 /tbody
 /table

 /body
 /html


[jQuery] Re: borders work fine with all browsers except IE7

2008-09-17 Thread ricardobeat

Look for a free hosting service. I'm not sure this is allowed, but
awardspace.com is a good and painless one.

cheers,
ricardo

On Sep 17, 11:36 am, Namlet [EMAIL PROTECTED] wrote:
 Ok, point taken, but I have a CSS file, a JS file, and an XHTML files,
 each are about 300 lines.  That's a little too much for this textbox,
 so how can I post this info for you to see?  It's not a public
 website.  Is there some online service that hosts text displaying
 versions of this stuff?

 On Sep 16, 1:53 pm, ricardobeat [EMAIL PROTECTED] wrote:

  Impossible to help without seeing some code. I don't see any magical
  jQuery gurus around.

  On Sep 16, 12:01 pm, Namlet [EMAIL PROTECTED] wrote:

   I have a site with several borders that are part of jQuery commands.
   One has rounded corners, others don't.  IE7 doesn't render ANY of
   these borders.  There are two divs that are not touched by jQuery, and
   their borders work fine.  Everything that has a jQuery click event, or
   rounded corners has no border at all.  Any ideas?


[jQuery] Re: best/standard way to benchmark your own scripts?

2008-09-17 Thread Andrew Hedges

Someone is bound to have a better answer than this, but to get you
started with profiling, have a look at this page where I include some
code to time my script execution:

http://andrew.hedges.name/experiments/simple-templates-speed-test/

It wouldn't be much of a stretch to apply this same pattern to
individual parts of the script to get a more detailed view. That said,
I'm pretty sure there are (commercial?) tools out there that let you
profile scripts in some detail. I'd be interested to know, too, if
there are any that are free software.

-Andrew

On Sep 17, 4:14 pm, Alex Weber [EMAIL PROTECTED] wrote:
 looking to find possible bottlenecks and basically optimize the hell
 outta my js which relies heavily on jquery and the occasional
 plugin...

 is there a more elegant and efficient way to do this than to toss a
 few document.write()s at my code?? =P

 thanks!!

 -Alex


[jQuery] Re: apples webclip feature in jquery

2008-09-17 Thread Tom Shafer

In safari 3 there is a webclip feature to make a widget for dashboard

http://www.apple.com/pro/tips/webclip.html

I am trying to make this in javascript and would like yo use jquery

On Sep 17, 10:54 am, Andy Matthews [EMAIL PROTECTED] wrote:
 Could you elaborate? What is this webclip of which you speak?

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

 Behalf Of Tom Shafer
 Sent: Wednesday, September 17, 2008 11:41 AM
 To: jQuery (English)
 Subject: [jQuery] apples webclip feature in jquery

 I am wanting to write something like apples webclip feature in safari for
 jquery, I am trying to figure out where the best place to start is. Does
 anyone have any ideas?

 Thanks,

 -TJ


[jQuery] Re: [validate] Pb with button

2008-09-17 Thread cage31

Thanks for your answer. With the meta-option all is fine.


  1   2   >