[jQuery] Re: Unlock Documentation

2009-09-24 Thread Scott Haneda


Wow, I thought I was the only one.  Has anyone looked at the form  
validation docs?  I thought it was a wiki style though?  No one can  
edit?

--
Scott * If you contact me off list replace talklists@ with scott@ *

On Sep 23, 2009, at 9:21 PM, rickoshay wrote:


The documentation is going to remain in its sorry state if they do not
unlock it and allow competent technical writers to update it. There is
no excuse, for example, for not describing the copy/move behavior of
the append function. One in a mountain of necessary documentation
updates.




[jQuery] Disabling parent link if children present

2009-09-24 Thread osu

Hi,

Is it possible to 'deactivate'/nullify a top-level link in an
unordered list if child links exist in that list?

For example, I have the following:

- Link 1
- Link 2
- Link 3
- Link 4
 - Link 4a
 - Link 4b
 - Link 4c
- Link 5

And I want to knock out Link 4 because it has sub-items.

Is that possible?

Thanks,

osu


[jQuery] Re: fadeOut callback problem - is this a bug?

2009-09-24 Thread cerberos

On Sep 24, 12:47 pm, cerberos pe...@whywouldwe.com wrote:
 The contents of a fadeOut callback are supposed to be executed after
 the fadeOut has completed but there are problems when fading out
 multiple selectors (the alert is used to demonstrate).

 $(#foo, #bar).fadeOut( function(){ alert('test'); $(#baz).fadeIn
 (); })

  #baz is faded in before the fadeOut has completed

 $(#foo, #bar).fadeOut( function(){ if( this.id == 'foo' ){ alert
 ('test'); $(#baz).fadeIn(); }})

  for some reason this works

 $(#foo, #bar).fadeOut( function(){ if( this.id == 'bar' ){ alert
 ('test'); $(#baz).fadeIn(); }})

  but this doesn't - it does the same as the first example

 Anyone know why? Is this a bug?


Found a blog post that covers the problem
http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/


[jQuery] Re: ajax returned data format

2009-09-24 Thread Flo

Thanks for your answers. I'm pretty sure my ajax call is done, thanks
to firebug (which is great by the way) and a few 'alert'. I suspected
extra white space (I must try a javascript trim...) at the end of my
string, I'll try JSON (must learn about it before). Great idea to
return an array too, with several identified chunks of data, it should
be handy for me. By the way, do you know good links about constructing
'heavily ajaxed' applications, managing and formatting data ? I'll
soon have to deal with this kind of project. But first JSON and
arrays...

thx again
Flo

On Sep 23, 11:42 pm, morris...@ingenious.org
morris...@ingenious.org wrote:
 Flo,

 I would suggest using $.getJSON() instead of the straight $.get() if
 you have the json_encode function available to you (PHP 5.2.x+ should
 have this). This is because you may have some extra white space at the
 end of what you are returning now.

 in your php do this

 ?php
 echo json_encode(array('success' = 'ok'));
 ?

 in js do this

 $.getJSON(phpfile.php, {param:param...}, function(data) {
      if(data.success == 'ok') {

      }

 });

 Chris

 On Sep 23, 11:24 am, Florian Motteau fmott...@gmail.com wrote:

  Hi all,

  I've been working with jQuery for a few weeks now (still a noob so :), and
  I'm a bit confused about getting information from a php file. Basically :

  MY JAVASCRIPT FILE:
  $.get(phpfile.php, {param:param...}, function(data) {

    if(data == ok) {
      ...do stuff...
    }

  })

  MY PHP FILE:
  ?php
  echo ok;
  ?

  In this dumb example, I'm unable to match the 'data' returned variable with
  the value I assigned to it in php (I can't manage to enter my 'do stuff'),
  yet its value is 'ok' if I display it. I have no problem to retrieve html
  code from php and inject it in my pages, but I can't test it as a regular
  javascript string.

  What's wrong in this ? What have I missed about the 'data' format ? Do I
  have to 'cast' data to a javascript string (and if so, how ?) ?

  And finally, sorry about my english, I'm french :-)

  thanks
  Flo


[jQuery] Re: Get rid of long-running script dialog box ?

2009-09-24 Thread Smeext

Well, first I'd like to thank you for participating in this
discussion.
  To answer Jonathan, you may be right, I am (or was ?) doing modular
exponentiations with large numbers.
I found out how to slightly improve efficiency, which means my script
is a bit faster, a good thing for time-based popups (Firefox/Chrome
(?) ..).
  But IE uses number of statements executed to know when to display
the warning. And I'm not sure I'll be able to split my function so it
requires less than 5 million instructions :/ (unless taking it from
scratch, ahaha).

S.



On 22 sep, 08:45, Jonathan Vanherpe (T  T NV) jonat...@tnt.be
wrote:
 Machin Pouet wrote:
  Hello all,

  I'd like to know if you have a way to disable the long-running script
  dialog boxes, as one can see many in this article :
 http://www.nczonline.net/blog/2009/01/05/what-determines-that-a-scrip...

  I can hardly split my processing into smaller chunks, and cannot ask
  clients to tweak their browsers or registry !

  I hope my call for help is in the right section, shouldn't it be the
  case, I apologize, but would appreciate any link to a potential solution.

  Looking forward to hear back from you,

  sincerely,

  S.

  From the article you linked:

 Brendan Eich, creator of JavaScript, is quoted as saying, [JavaScript]
 that executes in whole seconds is probably doing something wrong...

 And who are we do argue with him? You're probably using javascript for
 something you shouldn't use it for, or you have some kind of infinite
 loop. Could you give us an idea as to what exactly you're doing?

 Jonathan

 --www.tnt.behttp://www.tnt.be/?source=emailsig                *Jonathan 
 Vanherpe*
 jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be
 http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441


[jQuery] Re: Unlock Documentation

2009-09-24 Thread Jörn Zaefferer

As Karl mentioned, users registered for more then 24h can edit all
pages, with just a few exceptions, like the wiki homepage and the
About page.

So, could you guys be a bit more specific with your critique of
existing documentation?

Jörn

On Thu, Sep 24, 2009 at 7:57 AM, Scott Haneda talkli...@newgeo.com wrote:

 Wow, I thought I was the only one.  Has anyone looked at the form validation
 docs?  I thought it was a wiki style though?  No one can edit?
 --
 Scott * If you contact me off list replace talklists@ with scott@ *

 On Sep 23, 2009, at 9:21 PM, rickoshay wrote:

 The documentation is going to remain in its sorry state if they do not
 unlock it and allow competent technical writers to update it. There is
 no excuse, for example, for not describing the copy/move behavior of
 the append function. One in a mountain of necessary documentation
 updates.




[jQuery] select cannot check checkboxes' states

2009-09-24 Thread Xi Shen

hi,

i have a group of check boxes, and i want to iterator over all the
checked ones. i use the following code, but without luck.

$(input[type=checkbox][checked=true]).each(function()...);

can someone give a better solution?


-- 
Best Regards,
David Shen

http://twitter.com/davidshen84/
http://meme.yahoo.com/davidshen84/


[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread Sam Doyle
$(input[type=checkbox]:checked).each(function()...);

On Thu, Sep 24, 2009 at 9:59 AM, Xi Shen davidshe...@googlemail.com wrote:


 hi,

 i have a group of check boxes, and i want to iterator over all the
 checked ones. i use the following code, but without luck.

 $(input[type=checkbox][checked=true]).each(function()...);

 can someone give a better solution?


 --
 Best Regards,
 David Shen

 http://twitter.com/davidshen84/
 http://meme.yahoo.com/davidshen84/



[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread Jonathan Vanherpe (T T NV)


Xi Shen wrote:


hi,

i have a group of check boxes, and i want to iterator over all the
checked ones. i use the following code, but without luck.

$(input[type=checkbox][checked=true]).each(function()...);

can someone give a better solution?



[checked=checked] ?


--
Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be


[jQuery] Creating a new tag

2009-09-24 Thread Coxy

How do I create a new tag with jquery?

I tried something like this:

link = $('a').attr({
class   : 'logoLink',
target  : '_blank',
href: 'http://www.someurl.com/'
});

And then appended it to another image, but this added every link that
already existed on the page.


[jQuery] animate on page load

2009-09-24 Thread craigeves

 Hi all

Please can you help?

I want to animate the width of the 'progress_bar' div when the page
loads. I'm using the code below, which works fine in Firefox... but it
doesn't want to work in IE6.

Where am I going wrong?

Many thanks in advance


 $(document).ready(function(){

$(#progress_bar).animate({
width: 250px,
  }, 1500 );


  });


[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread Xi Shen

tried, not working ;(


On Thu, Sep 24, 2009 at 5:03 PM, Jonathan Vanherpe (T  T NV)
jonat...@tnt.be wrote:

 Xi Shen wrote:

 hi,

 i have a group of check boxes, and i want to iterator over all the
 checked ones. i use the following code, but without luck.

 $(input[type=checkbox][checked=true]).each(function()...);

 can someone give a better solution?


 [checked=checked] ?


 --
 Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be




-- 
Best Regards,
David Shen

http://twitter.com/davidshen84/
http://meme.yahoo.com/davidshen84/


[jQuery] Re: Creating a new tag

2009-09-24 Thread Xi Shen

$('a') means selecting all the 'a' tag element and set their attribute.

if you want to create an new element and add it to your page, try

var newAtag = $(document.createElement(a)).attr(...);
$(select the parent element).append(newAtag);


On Thu, Sep 24, 2009 at 5:06 PM, Coxy stephenbung...@yahoo.de wrote:

 How do I create a new tag with jquery?

 I tried something like this:

 link = $('a').attr({
                class   : 'logoLink',
                target  : '_blank',
                href    : 'http://www.someurl.com/'
        });

 And then appended it to another image, but this added every link that
 already existed on the page.



-- 
Best Regards,
David Shen

http://twitter.com/davidshen84/
http://meme.yahoo.com/davidshen84/


[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread Jonathan Vanherpe (T T NV)


tried Sam Doyle's response yet? It looks like that might be the proper way.
$(input[type=checkbox]:checked).each(function(){});

Jonathan

Xi Shen wrote:


tried, not working ;(


On Thu, Sep 24, 2009 at 5:03 PM, Jonathan Vanherpe (T  T NV)
jonat...@tnt.be  wrote:


Xi Shen wrote:


hi,

i have a group of check boxes, and i want to iterator over all the
checked ones. i use the following code, but without luck.

$(input[type=checkbox][checked=true]).each(function()...);

can someone give a better solution?



[checked=checked] ?


--
Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be








--
Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be


[jQuery] Re: Creating a new tag

2009-09-24 Thread g...@iec

var link = $('a/a').attr(attribute_name,value);
$(target_element).append(link);

This will work.

On Sep 24, 2:06 pm, Coxy stephenbung...@yahoo.de wrote:
 How do I create a new tag with jquery?

 I tried something like this:

 link = $('a').attr({
                 class   : 'logoLink',
                 target  : '_blank',
                 href    : 'http://www.someurl.com/'
         });

 And then appended it to another image, but this added every link that
 already existed on the page.


[jQuery] Re: animate on page load

2009-09-24 Thread Giovanni Battista Lenoci


craigeves ha scritto:

Where am I going wrong?

 $(document).ready(function(){

$(#progress_bar).animate({
width: 250px,
  }, 1500 );
  });
  
You have an error in your syntax that firefox ignores, after the 250px 
you have a comma.


Bye

--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 



[jQuery] Re: Creating a new tag

2009-09-24 Thread Giovanni Battista Lenoci


Coxy ha scritto:

How do I create a new tag with jquery?

I tried something like this:

link = $('a').attr({
class   : 'logoLink',
target  : '_blank',
href: 'http://www.someurl.com/'
});

And then appended it to another image, but this added every link that
already existed on the page.
  

Do you have an image and you want to add a link to the image? then do:

$('#myimgid').wrap('a class=logoLink target=_blank 
href=http://www.someurl.com/;/a');


Bye

--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 



[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread g...@iec

$('[type=checkbox]:checked').each(function(){})

This works.

On Sep 24, 2:22 pm, Jonathan Vanherpe (T  T NV) jonat...@tnt.be
wrote:
 tried Sam Doyle's response yet? It looks like that might be the proper way.
 $(input[type=checkbox]:checked).each(function(){});

 Jonathan



 Xi Shen wrote:

  tried, not working ;(

  On Thu, Sep 24, 2009 at 5:03 PM, Jonathan Vanherpe (T  T NV)
  jonat...@tnt.be  wrote:

  Xi Shen wrote:

  hi,

  i have a group of check boxes, and i want to iterator over all the
  checked ones. i use the following code, but without luck.

  $(input[type=checkbox][checked=true]).each(function()...);

  can someone give a better solution?

  [checked=checked] ?

  --
  Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be

 --
 Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be


[jQuery] Re: select cannot check checkboxes' states

2009-09-24 Thread Xi Shen

yes, Jonathan's method works.

thanks a lot ;)


On Thu, Sep 24, 2009 at 5:28 PM, g...@iec abhi.pur...@gmail.com wrote:

 $('[type=checkbox]:checked').each(function(){})

 This works.

 On Sep 24, 2:22 pm, Jonathan Vanherpe (T  T NV) jonat...@tnt.be
 wrote:
 tried Sam Doyle's response yet? It looks like that might be the proper way.
 $(input[type=checkbox]:checked).each(function(){});

 Jonathan



 Xi Shen wrote:

  tried, not working ;(

  On Thu, Sep 24, 2009 at 5:03 PM, Jonathan Vanherpe (T  T NV)
  jonat...@tnt.be  wrote:

  Xi Shen wrote:

  hi,

  i have a group of check boxes, and i want to iterator over all the
  checked ones. i use the following code, but without luck.

  $(input[type=checkbox][checked=true]).each(function()...);

  can someone give a better solution?

  [checked=checked] ?

  --
  Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be

 --
 Jonathan Vanherpe - Tallieu  Tallieu NV - jonat...@tnt.be



-- 
Best Regards,
David Shen

http://twitter.com/davidshen84/
http://meme.yahoo.com/davidshen84/


[jQuery] Re: Creating a tabbed UI

2009-09-24 Thread Richard D. Worth
On Wed, Sep 23, 2009 at 7:04 PM, Mike Alsup mal...@gmail.com wrote:


  Can someone post a simple example of creating a tabbed UI with JQUERY?

 For fully styled tabs you could use jQuery UI:

 http://docs.jquery.com/UI/Tabs


Demos and download links here: http://jqueryui.com/demos/tabs/

- Richard


[jQuery] Re: JQuery ui dialog issue

2009-09-24 Thread Richard D. Worth
On Wed, Sep 23, 2009 at 9:08 AM, g...@iec abhi.pur...@gmail.com wrote:


 Hi all,

 I have an issue.

 I am showing modal loading dialog while making ajax call.
 My dialog config is shown below :

 $('#loadingSearch').dialog({
autoOpen: false,
modal: !$.browser.msie,
bgiframe: true,
width: 270,
height: 'auto',
title:'Loading Search',
draggable: false,
resizable: false
});
$('.ui-dialog .ui-dialog-titlebar').hide();
$('#loadingSearch  div:eq(1)').css({'left':'135px'});
$('#loadingSearch').dialog('open');

 and closed by using following code :

 $('#loadingSearch').dialog('close');
$('#loadingSearch').dialog('destroy');
$('.ui-widget-overlay').remove();


any one of

$('#loadingSeach').dialog('close');

$('#loadingSeach').dialog('destroy');

$('#loadingSeach').remove();

should be automatically removing the overlay and restoring the elements to
be clickable. Please put together a minimal test page on jsbin.com (
http://jsbin.com/ ) and post to the jQuery UI list:

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

Thanks.

- Richard


[jQuery] Re: Single page application and jQuery

2009-09-24 Thread Phaedra

I've some news.

The nightly of jquery is not changed in this part (.html())

In the trunk, some changes are done by resig, that resolve the problem
for the .html method, using innerhtml.
So, the clock example is now not leaking at all.

But the .remove methond continue with this:
element.parentNode.removeChild(element), that does not remove the
leaking node in ie7.

I think this is better:

var garbage = document.getElementById(garbage);
if (!garbage) {
garbage = document.createElement(div);
garbage.setAttribute(id, garbage);
document.body.appendChild(garbage);
}
garbage.appendChild(this);
garbage.innerHTML = ;

What do you think? It's not better to use a generic GC in jquery for
dom elements?
this solve the problem in ie7.

Again, inserting a node into body, using DBJ way does not change
anithing, but in the trunk version the leaks are reduced.

Each time i insert a div node into body, it create 2 nodes into the
dom instead of 1. with garbage code in the remove method,
only one is correctly removed from memory, leaving only one leaking
element.

I hope Mr. Resig can read this post, because he is working on this
recently.




Unnecessary comments (was: Re: [jQuery] Re: jQuery(window).width() not registering sizes lower than 497 in Firefox.)

2009-09-24 Thread Bertilo Wennergren

Sam Doyle wrote:

 I just ran this:
 
 script type=text/javascript
 !--
   $('body').css('width','100px');
   $('body').append('br /'+$('body').width());
 --
 /script [...]

Those fake HTML comment lines (!--, --) are completely
superfluous. They haven't been needed for about 10 years or so
(even since Netscape 1 and Mosaic dissappeared).

But people are still religiously putting them in their code,
wasting propably terabytes of useless characters every year.

Why?

-- 
Bertilo Wennergren http://bertilow.com


[jQuery] document.body is null or not an object

2009-09-24 Thread mshaver

There is a ticket with JQuery,Ticket #5032, which describes a problem
where JQuery fails during start-up with the message document.body is
null or not an object. So far the bug is only reproducable in IE6. It
seems that a fix is not imminent for this issue, so I may need to
patch JQuery.

I am curious to know what the implications of wrapping the place in
code where the error is thrown from.

The error originates from support.js

82  // Figure out if the W3C box model works as expected
83  // document.body must exist before we can do this
84  jQuery(function(){
85  var div = document.createElement(div);
86  div.style.width = div.style.paddingLeft = 1px;
87
88  document.body.appendChild( div );
89  jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth
=== 2;
90  document.body.removeChild( div ).style.display = 'none';
91  div = null;
92  });

would change to:

82  // Figure out if the W3C box model works as expected
83  // document.body must exist before we can do this
84  jQuery(function(){
if (document.body != null){
85   var div = document.createElement(div);
86   div.style.width = div.style.paddingLeft = 1px;
87
88   document.body.appendChild( div );
89   jQuery.boxModel = jQuery.support.boxModel =
div.offsetWidth === 2;
90  document.body.removeChild( div ).style.display =
'none';
91  div = null;
}
92  });


As I understand, this method is performing a W3C box model support
test to determine if the browser renders the div in conformance with
W3C standards.  This is done when the library is first loaded.

I am hoping someone can answer the following:

1.If the attribute jQuery.boxModel is never referenced anywhere in
my code; can this break internal jQuery functionality at all?


2.Would it be better to simply comment this code altogether and
simply default jQuery.boxModel to false?


3.Is there any other code executed at start-up that I should be
concerned about?  (ie. anywhere else where a DOM test like this is
executed?


[jQuery] Want the submitted data from page loaded in iframe in parent page.

2009-09-24 Thread Nils

Hi all,
 I am relatively starter in php, javascript  jquery. I have a
web page that loads a signup page from other site. What i want to do
is get the signup information entered by user in the page inside
iframe on my current page so that i can store the data in my db. The
signup form that get loaded in iframe has submit button that does the
processing of the data entered by user. So i want the data on my
parent form.
anybody can help me on this???
Thanks in advance.
Regards
Nils


[jQuery] Re: Tablesorter is not sorting numbers correct

2009-09-24 Thread Fons

Ok thanks for that advise, the link is broken on that website, but
found an updated version on http://plugins.jquery.com/project/metadata

Works like a charm now!
thanks a lot

/Fons


On Sep 22, 10:23 pm, jlcox jl...@goodyear.com wrote:
 You'll need to include the metadata plugin if you want to do like
 that. See the bottom of the tablesorter download page.


[jQuery] Jquery and Pop up blockers

2009-09-24 Thread SEMMatt2

Does Jquery perform better or worse than other Java library with
regard to not triggering pop up blockers?

Thank you.


[jQuery] Re: Want the submitted data from page loaded in iframe in parent page.

2009-09-24 Thread Xi Shen

so where is your js reside? in the iframe or out side?
i think the best way is put your js in the iframe, so your parent
frame does not need to operate your iframe at all.


On Thu, Sep 24, 2009 at 12:44 PM, Nils nils.niran...@gmail.com wrote:

 Hi all,
         I am relatively starter in php, javascript  jquery. I have a
 web page that loads a signup page from other site. What i want to do
 is get the signup information entered by user in the page inside
 iframe on my current page so that i can store the data in my db. The
 signup form that get loaded in iframe has submit button that does the
 processing of the data entered by user. So i want the data on my
 parent form.
 anybody can help me on this???
 Thanks in advance.
 Regards
 Nils




-- 
Best Regards,
David Shen

http://twitter.com/davidshen84/
http://meme.yahoo.com/davidshen84/


[jQuery] .click() fires my callback more than once

2009-09-24 Thread Fabdrol

Hi guys,

I'm facing this little problem, I've got a button toolbar, and users
can select rows in a table. When they have selected some row's, they
can click one of the buttons, and it invokes a callback.

Problem is, when I click the first time, there's nothing wrong. But
when I click the second time, it fires the callback two times, when I
click the third time it fires the callback three times, and so on.
That's a big problem, since the button is used to delete a page, and
obviously it should delete it only once, since the AJAX would return
an error ortherwise.

The code is seperated in three blocks, first the the onclick on the
button object, which invokes a function called confirmAction, taking
to parameters. [1], a message for the users, [2] the name of the
callback function. When the confirmation is confirmed, the
confirmAction function calls the callback. As said before, when I
click #delete once, it behaves like expected. But when I click the
second time (without refresh) it runs the callback function twice,
third time thrice, and so on.

Below is my code...

Thanks in advance!

the onclick on the button object
[code]
$('#delete').click(function() {
confirmAction('Weet je zeker dat je de geselecteerde pagina\'s 
wilt
verwijderen?', 'destroy');
});
[/code]

the confirmation (global for my app, that's why callback is an
parameter)
[code]
var confirmAction = function(msg, callback) {
var context = $('#confirmAction');
$('p.msg', context).html(msg);

$.blockUI({
message: context,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
color: '#fff'
}
});

$('#confirmYes').click(function() {
$.unblockUI();
base[callback](true);
// [callback] is the function name, (true) the
parameter.
// base is global this cashed
});

$('#confirmNo').click(function() {
$.unblockUI();
return false;
});
}
[/code]

the callback:
[code]
var destroy = function(yesno) {
var arr = new Array();

if(yesno == true) {
$('input.do').each(function() {
if($(this).attr('checked') == true) {
arr.push($(this).val());
}
});

console.log(arr);
}
};
[/code]


[jQuery] [blockUI] IE: Cursor still displays hourglass symbol after unblocking

2009-09-24 Thread Franz Buchinger

I encountered a possible blockUI bug in IE7 and IE8: If you block the
ui and don't move your mouse after that, the cursor  displays the
hourglass symbol UNTIL you move your mouse again.

Thus, the .unblock() method doesn't have the desired effect on the
mouse cursor.

You can easily reproduce the effect with the blockUI demos: just click
on the Run Button without moving your mouse further.

kind regards,

Franz


[jQuery] Each function gives errors in IE6

2009-09-24 Thread Shane Riley

I've got a simple each function that finds every subnav and assigns it
a vertical position equal to half of the subnav's height. This works
great in all modern browsers, but in IE6 I get errors from each of the
two lines within the function. Here's the problem function:

$(.subnav).each(function(i)
{
top = (parseInt($(this).height()) / 2) - 6;
$(this).css(top, (- + top + px));
});

When I view the page in IE6, I get an error saying Not implemented.
If I comment out the line setting the top variable, I get an error
saying Invalid argument. Initially I was thinking the problem was in
setting the CSS property for top, but now it seems something else is
up.


[jQuery] Each function gives errors in IE6

2009-09-24 Thread Shane Riley

I've got a simple each function that finds every subnav and assigns it
a vertical position equal to half of the subnav's height. This works
great in all modern browsers, but in IE6 I get errors from each of the
two lines within the function. Here's the problem function:

$(.subnav).each(function(i)
{
top = (parseInt($(this).height()) / 2) - 6;
$(this).css(top, (- + top + px));
});

When I view the page in IE6, I get an error saying Not implemented.
If I comment out the line setting the top variable, I get an error
saying Invalid argument. Initially I was thinking the problem was in
setting the CSS property for top, but now it seems something else is
up.


[jQuery] Re: Each function gives errors in IE6

2009-09-24 Thread Shane Riley

Weird double post. Found the issue. For some reason declaring the
variable worked. So I changed it to:
var  top = (parseInt($(this).height()) / 2) - 6;

On Sep 24, 7:31 am, Shane Riley shanerileydoti...@gmail.com wrote:
 I've got a simple each function that finds every subnav and assigns it
 a vertical position equal to half of the subnav's height. This works
 great in all modern browsers, but in IE6 I get errors from each of the
 two lines within the function. Here's the problem function:

 $(.subnav).each(function(i)
         {
                 top = (parseInt($(this).height()) / 2) - 6;
                 $(this).css(top, (- + top + px));
         });

 When I view the page in IE6, I get an error saying Not implemented.
 If I comment out the line setting the top variable, I get an error
 saying Invalid argument. Initially I was thinking the problem was in
 setting the CSS property for top, but now it seems something else is
 up.


[jQuery] jQuery crashing the page

2009-09-24 Thread Sam Doyle

I've got 2 pages:

a current events page and a past events page

the current events page loads fine as there is only about 10 events
the past events page takes about 30 seconds to load and will crash if
u click your mouse in the loading time

The pages are near identical the only difference is the query that
selects the events ( versus )

The page loads immediately without:
script type=text/javascript src=http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.min.js/script

But when i put it back in the above happens. Any ideas welcome!

PC I'm using jQuery.roundedcorners.

Sam


[jQuery] Re: Parse encoded HTML in XML content node

2009-09-24 Thread Fabdrol

Hi Jeff,

Could you post your JS code and your XML? I'd like to play around with
it for you, but things aren't really clear right now ;-)

Fabian

On 23 sep, 21:36, Jeff jpellet...@nesn.com wrote:
 Hi,

 I'm using $.ajax with a dataType of xml.  The XML document I'm getting
 has a content node that contains a bunch of encoded HTML.  Sample:

 contentlt;pgt;lt;a href=quot;

 When I alert the text contained within the content node:

 alert(data.find('content').text());

 I can see the above encoded content as formatted HTML:

 pa href=

 I realize that the text() function is returning text, and not the
 nodes within.  How can I return the nodes within, either as a jQuery
 object or the DOM nodes themselves, rather than the text, so I can
 actually parse them?

 When I remove the .text() function from the above, ala:

 data.find('content p');

 I get Undefined.  I've tried all kinds of selectors, and nothing
 works.

 Finally data.find('content); returns object Object.

 Thanks,
 Jeff


[jQuery] validate date regexp

2009-09-24 Thread adexcube

Hi, I'm using the jQuery validation plugin + masked Input 1.2.2 and
both works very well.
I'd like to add a validation function for dates with the format dd/mm/

I took the regexp from 
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
specifically from Marco Antonio's post but if figured out that it
doesn't  work well for all leap years, for example it works for
29/02/2004 but not for 29/02/2000

Is there any way someone can tweak the regexp a little bit?

Thanks

jQuery.validator.addMethod(
date,
function(value, element) {
var check = false;
var re = 
/^(?:(?:(?:0?[1-9]|1\d|2[0-8])\/(?:0?[1-9]|1[0-2]))\/(?:(?:1
[6-9]|[2-9]\d)\d{2}))$|^(?:(?:(?:31\/0?[13578]|1[02])|(?:(?:29|30)\/(?:
0?[1,3-9]|1[0-2])))\/(?:(?:1[6-9]|[2-9]\d)\d{2}))$|^(?:29\/0?2\/(?:(?:
(?:1[6-9]|[2-9]\d)(?:0[48]|[2468][048]|[13579][26]$/
if( re.test(value)){
check = true;
   }

return this.optional(element) || check;
},
Please enter a correct date
);


[jQuery] Re: Each function gives errors in IE6

2009-09-24 Thread Nick Fitzsimons

2009/9/24 Shane Riley shanerileydoti...@gmail.com:

 Weird double post. Found the issue. For some reason declaring the
 variable worked. So I changed it to:
 var  top = (parseInt($(this).height()) / 2) - 6;


That's because top is already defined as a synonym for the top-level
window object, and IE gets upset if you try to overwrite it.

I think you'd get the same Not implemented error if you tried to
assign values to the global self, parent, and window properties
too. Assuming you're not running in a frame or an iframe, self,
top, parent, and window all refer to the same object. In a frame
or iframe, self and window will refer to the framed document's
window, and top will refer to the window object of the very
topmost document, while parent will refer to the window object of
the document containing the frame, which is not the same as top if
you have nested frames/iframes.

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/


[jQuery] Find top-level elements

2009-09-24 Thread Grimace of Despair

Working on WinXP in FireFox 3.0.14 with JQuery 1.3.2, I'm trying the
following code:

$.ajax({
  url: http://foo.bar/document;
  data: 'r=' + Math.random(),
  success: function(value) {

var body = $(value).find('body'); // Always empty
var form = $(value).find('form'); // Always empty
var p = $(value).find('p'); // Actual paragraphs

  }
});

Now, body and form are always empty, while p contains actual
paragraphs.

When I debug $(value) with Firebug, I see that it has become an array
with some text nodes (whitespace), some link nodes (css) and a form
node. The form node contains script nodes (although in the html, they
occur in the head) and the content html.

Now I'd like body and form to contain their respective counterpart
from the newly loaded content, but, aside from doing some custom
implementation, can I do that with JQuery in some way with a find?
Obviously, the current find on body/form does not work, because it's
applied iteratively on the array and it cannot find top-level element.
The find('p') does work because they are not top-level within an array
node.

Regards,

Grimace


[jQuery] Refresh only a section of the page

2009-09-24 Thread Macovei Catalin

Hello,
i am trying to use ajax for my site and i have a problem.
I have a live radio running on my home page and the rest, and i want
to navigate through the website without having to make the buffering
again.
I've searched multiple forums but no solutions.
Can you help me?


[jQuery] Re: fadeOut callback problem - is this a bug?

2009-09-24 Thread Mike McNally

Are you forgetting that fadeOut takes *two* parameters?  The first
should be the speed of the effect, and the second is your callback
function.


On Thu, Sep 24, 2009 at 12:47 AM, cerberos pe...@whywouldwe.com wrote:

 The contents of a fadeOut callback are supposed to be executed after
 the fadeOut has completed but there are problems when fading out
 multiple selectors (the alert is used to demonstrate).


 $(#foo, #bar).fadeOut( function(){ alert('test'); $(#baz).fadeIn
 (); })
 #baz is faded in before the fadeOut has completed


 $(#foo, #bar).fadeOut( function(){ if( this.id == 'foo' ){ alert
 ('test'); $(#baz).fadeIn(); }})
 for some reason this works


 $(#foo, #bar).fadeOut( function(){ if( this.id == 'bar' ){ alert
 ('test'); $(#baz).fadeIn(); }})
 but this doesn't - it does the same as the first example


 Anyone know why? Is this a bug?



-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.


[jQuery] Re: Jquery and Pop up blockers

2009-09-24 Thread Mike McNally

If you're not popping up new browser windows then you shouldn't have
to worry about popup blockers, and it has nothing to do with what
Javascript library you're using.

On Wed, Sep 23, 2009 at 8:40 PM, SEMMatt2 mattluk...@gmail.com wrote:

 Does Jquery perform better or worse than other Java library with
 regard to not triggering pop up blockers?

 Thank you.




-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.


[jQuery] complicated form with 'child objects'

2009-09-24 Thread csetzkorn

Hi,

I try to implement a form for an item that can have several ‘child
objects’ - addresses (let us say with 3 strings: postcode, country,
city to keep things simple). The addresses will be send as a
stringified JSON array together with the remaining form elements to
the server (using the forms plugin) . I guess I will need some kind of
subform and a table (?) to store the ‘child objects’ with the
possibility to delete ‘child objects’ before posting.

 I am sure someone must have implemented something similar (possibly
using a nice jquery plugin?). Any pointers would be very much
appreciated. Many thanks in advance.

Christian


[jQuery] Re: .click() fires my callback more than once

2009-09-24 Thread Liam Potter


probably because you have click handlers inside the confirmAction 
function, which is run on click itself.

Fabdrol wrote:

Hi guys,

I'm facing this little problem, I've got a button toolbar, and users
can select rows in a table. When they have selected some row's, they
can click one of the buttons, and it invokes a callback.

Problem is, when I click the first time, there's nothing wrong. But
when I click the second time, it fires the callback two times, when I
click the third time it fires the callback three times, and so on.
That's a big problem, since the button is used to delete a page, and
obviously it should delete it only once, since the AJAX would return
an error ortherwise.

The code is seperated in three blocks, first the the onclick on the
button object, which invokes a function called confirmAction, taking
to parameters. [1], a message for the users, [2] the name of the
callback function. When the confirmation is confirmed, the
confirmAction function calls the callback. As said before, when I
click #delete once, it behaves like expected. But when I click the
second time (without refresh) it runs the callback function twice,
third time thrice, and so on.

Below is my code...

Thanks in advance!

the onclick on the button object
[code]
$('#delete').click(function() {
confirmAction('Weet je zeker dat je de geselecteerde pagina\'s 
wilt
verwijderen?', 'destroy');
});
[/code]

the confirmation (global for my app, that's why callback is an
parameter)
[code]
var confirmAction = function(msg, callback) {
var context = $('#confirmAction');
$('p.msg', context).html(msg);

$.blockUI({
message: context,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
color: '#fff'
}
});

$('#confirmYes').click(function() {
$.unblockUI();
base[callback](true);
// [callback] is the function name, (true) the
parameter.
// base is global this cashed
});

$('#confirmNo').click(function() {
$.unblockUI();
return false;
});
}
[/code]

the callback:
[code]
var destroy = function(yesno) {
var arr = new Array();

if(yesno == true) {
$('input.do').each(function() {
if($(this).attr('checked') == true) {
arr.push($(this).val());
}
});

console.log(arr);
}
};
[/code]
  




[jQuery] Re: jQuery in loaded content doesn't work

2009-09-24 Thread mstone42

Thanks, Chris!  I'll give livequery a try.


[jQuery] Re: jQuery in loaded content doesn't work

2009-09-24 Thread Dave Maharaj :: WidePixels.com

I ran into the same thing. I have the apple style slider that is on a page
that gets loaded into a div as content. And it no longer works. I would be
interested in following this post to see if any headway is made in this
particular topic.

Dave 

-Original Message-
From: mstone42 [mailto:si...@rocketmail.com] 
Sent: September-24-09 11:46 AM
To: jQuery (English)
Subject: [jQuery] Re: jQuery in loaded content doesn't work


Thanks, Chris!  I'll give livequery a try.



[jQuery] XHTML or HTML when creating elements?

2009-09-24 Thread Bertilo Wennergren


According to the jQuery documentation we're
supposed to write like this:

  $(span/)

and not like this:

  $(span)

http://docs.jquery.com/Core/jQuery#htmlownerDocument

That means using XHTML style code for the
elements created.

Are we supposed to do that even when we are using
HTML style code (e.g. HTML 4.01)?

E.g.:

  $('#whatever').html('img alt= src=... /');

That would seem a bit bizarre if the actual HTML
page has lots of 'img alt= src=' without the
ending slash.

It does seem that img, br etc. work without the
ending slash as well.

--
Bertilo Wennergren http://bertilow.com


[jQuery] Deactivating parent link with JQuery

2009-09-24 Thread osu

I wrote this message earlier, but it got unpublished for some
reason...?

Is there a way of 'knocking out' i.e. removing the link from a parent
item in a list of links IF it has children links?

For example, 'deactivate' Link 3 only:

- Link 1
- Link 2
- Link 3
 - Link 3a
 - Link 3b
 - Link 3c
- Link 4

Is that possible? I think it should be with selectors, but can anyone
show me how?

Thanks,

osu


[jQuery] Re: Deactivating parent link with JQuery

2009-09-24 Thread Andi23

First of all, let's clarify the actual HTML.  I assume this is what
you have:
ul
lia href=#Link 1/a/li
lia href=#Link 2/a/li
lia href=#Link 3/a
ul
lia href=#Link 3a/a/li
lia href=#Link 3b/a/li
lia href=#Link 3c/a/li
/ul
/li
lia href=#Link 4/a/li
/ul

When you say remove the link, I assume you want to turn this:
lia href=#Link 3/a
into this:
liLink 3

Given that, try this jQuery:
$(li ul).siblings(a).each(function(){
$(this).replaceWith($(this).html());
});


[jQuery] Re: Way to convert DOM event to jQuery event?

2009-09-24 Thread Kevin Dalman

If you need data for multiple fields, then a 3rd option is to create a
single hash/data object for the page and writing all your data into
that. This makes your data easy to read and debug, and is highly
efficient because you don't have to 'parse' anything...

var Record = {
foo:  db-value-1
,   bar:  db-value-2
,   baz:  db-value-3
}

Then you can use *either* jQuery or inline events to access this
data...

$(document).ready(function() {
 $(#myID).click(function() {
  alert( foo =  + Record.foo );
  return false;
 });
});

You could use the fieldnames as keys in your data object to make it
generic...

var Record = {
myID1:  db-value-1
,   myID2:  db-value-2
,   myID3:  db-value-3
...
}

$(document).ready(function() {
 $(a.linkType).click(function() {
  alert( this.id +  =  + Record[ this.id ] );
  return false;
 });
});

/Kevin


On Sep 23, 5:57 pm, Ricardo Tomasi ricardob...@gmail.com wrote:
 Do you really need to output this data embedded in the HTML? Does it
 have any meaning/purpose without Javascript? There are two simple non-
 hackish ways you can do it:

 1:
 load data later via XHR, use an element identifier to bind it

 2:
 output metadata in the class attribute - it's valid, and not against
 the specification - the class attribute is not specifically meant for
 presentation, the specs say For general purpose processing by user
 agents.
 ex: class=link { foo: 'bar', amp: 'bamp', x: [1,2,3] }.

 It's easy to create your own parser for that:

 $.fn.mdata = function(){
    return window[eval](( + this[0].className.match(/{.*}/) + ));

 };

 $('a').mdata() == Object foo:'bar' etc..

 It will work as long as you use valid JSON.

 cheers,
 Ricardo



[jQuery] Load quicktime as needed

2009-09-24 Thread RealMason

I'm a total jquery newbie and I'm just trying to find out if something
is possible.

If I have a full album worth of songs that I want to list on a web
page, can I use jquery to only embed the quicktime file after the user
clicks on a play button for that track.

Similar to Amazon's or iTunes play button per track.

The way I'm doing it right now, every song is embedded and therefore
is progressively downloading and soaking up bandwidth even though the
user may only listen to one song (or none).

Essentially, I want the song to only progressively download IF the
user clicks play.

I am NOT asking about autoplay versus click to play... instead my
question is about controlling the point in time that the file gets
embedded and starts downloading to the browser.

Any direction would be appreciated. I do have the jquery.media.js
plug in.

My ideal solution would be a list of song titles and a play button.
When the user clicks the play button, the quicktime play is revealed
below the title and ONLY at that moment does the file start
downloading.

Thanks.


[jQuery] jQuery plugin help

2009-09-24 Thread Nalum

Hello All,
I'm trying to create a plugin that I want to be able to call like
$.pluginname(...) where currently I have to call the plugin like this $
(...).pluginname.

Any help would be greatly appreciated.

Nalum


[jQuery] append and selector problem;

2009-09-24 Thread dattu

Hi,

I am facing one problem In jquery. For easy understanding, below html
code created.

Before clicking on CHANGE label if click on 12345, I am getting
hiii alert message.
After clicking on CHANGE I am not getting alert message.(I am
experting hii should come on click of 67890 also).

code sample

html
head
  script src=http://code.jquery.com/jquery-latest.js;/script

  script
  $(document).ready(function(){
  $('#change').click(function(){
  $('#div1').empty();
  $('#div1').append('tabletheadthNEW TEST/th/
theadtbodytrtd67890/td/trtrtdEFGHI/td/tr/tbody');
});
$(tbody tr).click(function(){
alert(hii);
});


  });
  /script

/head
body
  div id=div1
label id=changeCHANGE/label
table
thead
th
TEST
/th
/thead
tbody
tr
td12345/td
/tr
tr
tdABCD/td
/tr
/tbody
  /div
/body
/html

1) Please explain why this is not behaving as experted.
2) In case of NOTE (see at last) change, why it is working?
3) how can I slow this issue

NOTE:- If i change like below it is working.

$(document).ready(function(){
  $('#change').click(function(){
  $('#div1').empty();
  $('#div1').append('tabletheadthNEW TEST/th/
theadtbodytrtd67890/td/trtrtdEFGHI/td/tr/tbody');

$(tbody tr).click(function(){
alert(hii);
});

});
  });


[jQuery] (treeview)

2009-09-24 Thread Michiel

I'm very new a jQuery, and still just learning.

I've succesfully implented the treeview plugin on my html list. Only,
I don't want it to collapse when I click on a expanded folder. I do
want it to collapse when I click on a other folder that's not a child.
So that you only have one branch visible.

My javascript is still poor, but I'm a quick learner. My normally
script languages are PHP and Actionscript (2 and 3)

Thanx in advance


[jQuery] (autocomplete)

2009-09-24 Thread Ordos

I am using the jQuery plugin autocomplete on an country input field:

I got this php array with countries in dutch:
$global_countries = array();
$global_countries['AF'] = 'Afghanistan';
$global_countries['AX'] = 'Ålandseilanden';
$global_countries['AL'] = 'Albanië';
...

Then php implodes the array and evals a html file to fill the js var.
This is in my html file:

var countries = [$countries];
$(#country).autocomplete(countries, {
minChars: 2,
max: 12,
autoFill: false,
mustMatch: true,
matchContains: true,
scrollHeight: 220
});

But now, when I start to type a country I get ALL special characters
like: Belgi�

If I use php htmlentities on each country it is displayed like it
should in the select list, but when selected I see the ASCII code of
course. België becomes Belgieuml;


[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Richard D. Worth
I won't speak to the jQuery documentation, nor jQuery's internal
implementation for $(html), only your questions about HTML and XHTML, based
on my own knowledge and best practices:

*Non-void elements (sometimes called non-empty elements, meaning they can
contain text and child nodes)*
For an empty span element on its own, neither

span/

nor

span

is technically valid HTML or XHTML, unless you rely on the html parser to
auto-close the element. And the rules for doing that depend on the element,
what follows it, and which html parser is being used (ie, which browser). As
a best practice, I, and the jQuery UI project by convention, always use

span/span

as a valid and consistent way to open and close a non-void but initially
empty element. Because many elements have an optional closing tag in html,
according to how browser html parsers behave, many people continue to use

span

or

span/

and they may never have any problems in any browsers with that, though the
latter is merely an XML-compatible version of the former, not technically
valid XHTML as span is a non-void element. In the case of that (X)HTML being
parsed as html, which is most common, the browser will ignore the slash
inside the opening tag (as if you had specified span) and when it self
closes, it will be as if you had specified

span/span

*Void elements (sometimes called empty elements, meaning they cannot contain
text or child nodes)*
Void elements never have a closing tag, and don't require a closing slash in
the tag in HTML, but allow it for compatability with XHTML, which does
require it. See

http://wiki.whatwg.org/wiki/FAQ#Should_I_close_empty_elements_with_.2F.3E_or_.3E.3F

This is a relatively short list of elements (this one from
http://www.elharo.com/blog/software-development/web-development/2007/01/29/all-empty-tags-in-html/#comment-227448
):

area
base
basefont
br
col
frame
hr
img
input
isindex
link
meta
param

the most common ones being img and input. Note it does not include some very
commonly created elements such as

a
div
li
ol
span
table
td
th
tr
ul

- Richard

On Thu, Sep 24, 2009 at 11:30 AM, Bertilo Wennergren berti...@gmail.comwrote:


 According to the jQuery documentation we're
 supposed to write like this:

  $(span/)

 and not like this:

  $(span)

 http://docs.jquery.com/Core/jQuery#htmlownerDocument

 That means using XHTML style code for the
 elements created.

 Are we supposed to do that even when we are using
 HTML style code (e.g. HTML 4.01)?

 E.g.:

  $('#whatever').html('img alt= src=... /');

 That would seem a bit bizarre if the actual HTML
 page has lots of 'img alt= src=' without the
 ending slash.

 It does seem that img, br etc. work without the
 ending slash as well.

 --
 Bertilo Wennergren http://bertilow.com



[jQuery] Re: Disabling parent link if children present

2009-09-24 Thread Giovanni Battista Lenoci


osu ha scritto:

- Link 1
- Link 2
- Link 3
- Link 4
 - Link 4a
 - Link 4b
 - Link 4c
- Link 5
  

I suppose you have a similar markup:

ul id=mymenu
lia href=http://www.jquery.com;Jquery/ali
lia href=#Search Engines/a
 ul
 lia href=http://www.google.com;Google/a/li
 lia href=http://www.bing.com;Bing/a/li
 /ul
/li
/ul

This is untested, but should work:

$('#mymenu a').click(function() {
 if($('ul', $(this).parent()).length  0) {
return false;
 }
});

Bye


--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 



[jQuery] Re: Deactivating parent link with JQuery

2009-09-24 Thread osu

Thanks Andi,

Yes, I meant an unordered list as you showed.

Rather than remove the a tag, is it possible to just 'deactivate'
it? i.e. when you click it, nothing happens, but the a tag stays in
place?

I ask, because I'd like to keep the CSS as simple as possible.

Thanks,

osu


On Sep 24, 6:05 pm, Andi23 dowhatyouw...@gmail.com wrote:
 First of all, let's clarify the actual HTML.  I assume this is what
 you have:
 ul
     lia href=#Link 1/a/li
     lia href=#Link 2/a/li
     lia href=#Link 3/a
         ul
             lia href=#Link 3a/a/li
             lia href=#Link 3b/a/li
             lia href=#Link 3c/a/li
         /ul
     /li
     lia href=#Link 4/a/li
 /ul

 When you say remove the link, I assume you want to turn this:
 lia href=#Link 3/a
 into this:
 liLink 3

 Given that, try this jQuery:
 $(li ul).siblings(a).each(function(){
     $(this).replaceWith($(this).html());

 });


[jQuery] Changing a class name without clicking

2009-09-24 Thread Lleoun

Hi all,

I have the following:

div  class=unselected content/div

I want to change unselected into selected when calling a function.

The ways I'm finding to do a class name change is using a clicking:
$('.unselected').click(function(){
   $('.selected').attr('class','unselected');
   $(this).attr('class','selected');
});

But I don't want to click, I need to do it by calling a function ..
how can I do that?
Thanks a lot !


[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Bertilo Wennergren


Richard D. Worth wrote:


I won't speak to the jQuery documentation, nor jQuery's internal
implementation for $(html), only your questions about HTML and XHTML, based
on my own knowledge and best practices: [...]


Thanks!

So if I understand your points, the following examples can be called 
best practices when using jQuery along with HTML 4.01:


  $('#whatever').html('div/div');
  $('#whatever').html('br');
  $('#whatever').html('img alt= src=...');

Actually I code everthing in XHTML, but I still wondered
how this is supposed to be done in jQuery in old style HTML.

I think I read somewhere that jQuery just passes the
code along to the innerHTML function of the browser.
That would mean that the actual rules are those of the
browsers' various implementations of innerHTML (whatever
those may be...).

--
Bertilo Wennergren http://bertilow.com


[jQuery] Re: Changing a class name without clicking

2009-09-24 Thread Jon Banner
you'll need an event to attach your function call to, whether that's
document ready or click or...

you might also find toggleClass http://docs.jquery.com/Attributesto be
useful here

Jon


2009/9/24 Lleoun adoming...@vivocom.es


 Hi all,

 I have the following:

 div  class=unselected content/div

 I want to change unselected into selected when calling a function.

 The ways I'm finding to do a class name change is using a clicking:
 $('.unselected').click(function(){
   $('.selected').attr('class','unselected');
   $(this).attr('class','selected');
 });

 But I don't want to click, I need to do it by calling a function ..
 how can I do that?
 Thanks a lot !



[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Richard D. Worth
Best practice, valid HTML, and compatible with XHTML would be
$('#whatever').html('div/div');
$('#whatever').html('br /');
$('#whatever').html('img alt= src=... /');

- Richard

On Thu, Sep 24, 2009 at 12:33 PM, Bertilo Wennergren berti...@gmail.comwrote:


 Richard D. Worth wrote:

  I won't speak to the jQuery documentation, nor jQuery's internal
 implementation for $(html), only your questions about HTML and XHTML,
 based
 on my own knowledge and best practices: [...]


 Thanks!

 So if I understand your points, the following examples can be called best
 practices when using jQuery along with HTML 4.01:

  $('#whatever').html('div/div');
  $('#whatever').html('br');
  $('#whatever').html('img alt= src=...');

 Actually I code everthing in XHTML, but I still wondered
 how this is supposed to be done in jQuery in old style HTML.

 I think I read somewhere that jQuery just passes the
 code along to the innerHTML function of the browser.
 That would mean that the actual rules are those of the
 browsers' various implementations of innerHTML (whatever
 those may be...).


 --
 Bertilo Wennergren http://bertilow.com



[jQuery] Re: How can i add Buttons?

2009-09-24 Thread Jon Banner
jCarousel ?? did you try this?
http://sorgalla.com/projects/jcarousel/examples/static_controls.html

2009/9/21 Pesimist pckopat.fene...@gmail.com


 hello everyone.
 i have a problem. i wanna add left and right buttons but i couldn't i
 have tried long time so really i need.

 i am looking for like this for example:

 a href=# id=mycarousel-prevPrev/a

 or

 a href=# id=mycarousel-previmg src=images/prev.gif/a

 i wanna put like this buttons. please help me.



[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Bertilo Wennergren


Richard D. Worth wrote:


Best practice, valid HTML, and compatible with XHTML would be
$('#whatever').html('div/div');
$('#whatever').html('br /');
$('#whatever').html('img alt= src=... /');


Well, not quite valid HTML...

If you use br / in an HTML 4.01 page, the validator at
w3.org gives a warning with the following explanation:

  The sequence FOO / can be interpreted in at least two different
  ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict,
  the '/' terminates the tag FOO (with an implied ''). However, since
  many browsers don't interpret it this way, even in the presence of an
  HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure
  HTML documents and reserve its use solely for those written in XHTML.

That means that br / is valid, but it does not mean what
it was supposed to mean (in HTML 4.01). It means br!

Still, it's not likely that any browser will actually
produce br from $('#whatever').html('br /').
But we're talking best practices here.

--
Bertilo Wennergren http://bertilow.com


[jQuery] Re: Way to convert DOM event to jQuery event?

2009-09-24 Thread Brett Ritter

On Thu, Sep 24, 2009 at 12:10 PM, Kevin Dalman kevin.dal...@gmail.com wrote:

 If you need data for multiple fields, then a 3rd option is to create a
 single hash/data object for the page and writing all your data into
 that. This makes your data easy to read and debug, and is highly
 efficient because you don't have to 'parse' anything...

And while all of the above are true, a 4th (not necessarily better)
option is to have a script block on the page that is NOT
language=text/javascript.  That results in a valid page that
nonetheless has the data available to Jquery.

http://ejohn.org/blog/javascript-micro-templating/

That said, however, I'd say:
If the data is JS specific, drop it into the attribute data.
If the data could be relevant to other consumers of the page (even if
they don't exist yet) the suggestion for the class attr sounds solid.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Re: Changing a class name without clicking

2009-09-24 Thread Lleoun

Thanks for answering Jon.
I'm a newbie I'm afraid .. so you mean something like this:

$('.unselected').ready(function(){

   $('.selected').attr('class','unselected');
   $(this).attr('class','selected');


});


Thanks again


[jQuery] Re: Deactivating parent link with JQuery

2009-09-24 Thread Andi23

In that case, you can just remove the href attribute of the link(s):
$(li ul).siblings(a).removeAttr(href);

or, if you want to leave in the href attribute for future use?, you
can do this:
$(li ul).siblings(a).click(function(){
return false;
});

good luck-


[jQuery] Re: Changing a class name without clicking

2009-09-24 Thread Andi23

Hi there,
You say you want to do this by calling a function, not by clicking.
But let me ask you something: How are you going to call the function?
In other words, when do you want this class change to happen?  Do you
want it to happen as soon as the page loads?  Do you want it to happen
10 seconds after the page loads?  Do you want it to happen when you
mouse over a little red button that says Mouse over me to change the
class now?  I can't help you without this information.
Andi


[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Richard D. Worth
On Thu, Sep 24, 2009 at 12:53 PM, Bertilo Wennergren berti...@gmail.comwrote:


 Richard D. Worth wrote:

  Best practice, valid HTML, and compatible with XHTML would be
 $('#whatever').html('div/div');
 $('#whatever').html('br /');
 $('#whatever').html('img alt= src=... /');


 Well, not quite valid HTML...


quite valid. See in the below paragraph That means that 'br /' is valid



 If you use br / in an HTML 4.01 page, the validator at
 w3.org gives a warning with the following explanation:

  The sequence FOO / can be interpreted in at least two different
  ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict,
  the '/' terminates the tag FOO (with an implied ''). However, since
  many browsers don't interpret it this way, even in the presence of an
  HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure
  HTML documents and reserve its use solely for those written in XHTML.

 That means that br / is valid, but it does not mean what
 it was supposed to mean (in HTML 4.01). It means br!


Having to ignore this warning is a pain, and that's remedied by HTML5. As I
posted previously, in HTML5 it is allowed (not recommended nor required)
because it's in such common use for compatibility with XHTML.


 Still, it's not likely that any browser will actually
 produce br from $('#whatever').html('br /').
 But we're talking best practices here.


One best practice I have is that any (X)HTML I write should require as
little modification as possible to be made one or the other. The HTML5 spec
and FAQ give me confidence that no useful browser or html parser will do
the wrong thing with br / parsed as text/html, so it's worth the
potential ease of migration to/from XHTML. If nothing else, it's a best
practice that allows one to read and write HTML and XHTML without having to
remember as much.

- Richard


[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Bertilo Wennergren


Richard D. Worth wrote:


On Thu, Sep 24, 2009 at 12:53 PM, Bertilo Wennergren berti...@gmail.comwrote:


Richard D. Worth wrote:

 Best practice, valid HTML, and compatible with XHTML would be

$('#whatever').html('div/div');
$('#whatever').html('br /');
$('#whatever').html('img alt= src=... /');


Well, not quite valid HTML...



quite valid. See in the below paragraph That means that 'br /' is valid


Yes, valid, but valid code for br, not for br.
Splitting hairs, I know...


If you use br / in an HTML 4.01 page, the validator at
w3.org gives a warning with the following explanation:

 The sequence FOO / can be interpreted in at least two different
 ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict,
 the '/' terminates the tag FOO (with an implied ''). However, since
 many browsers don't interpret it this way, even in the presence of an
 HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure
 HTML documents and reserve its use solely for those written in XHTML.

That means that br / is valid, but it does not mean what
it was supposed to mean (in HTML 4.01). It means br!



Having to ignore this warning is a pain, and that's remedied by HTML5. As I
posted previously, in HTML5 it is allowed (not recommended nor required)
because it's in such common use for compatibility with XHTML.


Quite welcome.


Still, it's not likely that any browser will actually
produce br from $('#whatever').html('br /').
But we're talking best practices here.



One best practice I have is that any (X)HTML I write should require as
little modification as possible to be made one or the other. The HTML5 spec
and FAQ give me confidence that no useful browser or html parser will do
the wrong thing with br / parsed as text/html,
so it's worth the
potential ease of migration to/from XHTML. If nothing else, it's a best
practice that allows one to read and write HTML and XHTML without having to
remember as much.


Indeed.

The question about br / arose when I was demonstrating
how the same inline JS example is supposed to look like in HTML
and in XHTML. When I was changing one version from it's XHTML
incarnation into an HTML incarnation, removing all the
ending slashes from meta elements etc., I suddenly stopped
at the included jQuery code that happend to have a piece
of '.html(br / whatever...)' in it, suddenly not knowing
if I'm supposed to remove that slash or not. I really did not
know - since I'm quite new to jQuery (being in the process of
converting from Prototype...). So I had to ask. Sorry about
all the hairs being split in the process!

--
Bertilo Wennergren http://bertilow.com


[jQuery] Re: Execute jQuery from links

2009-09-24 Thread Andi23

That should work in theory, but your structure is wrong.

If you do something like this:
a href=# onclick=$(this).text('yes');Will this work?/a
you will see that it works when you click it.

The javascript: protocol is not necessary, but it won't break anything
if you leave it in.


[jQuery] Trouble with backgroundPosition Plugin

2009-09-24 Thread rob

Having some trouble with this plugin.  I've tried in both IE8 and FF3,
but it doesn't seem to work.

Basically the background position isn't moving...

the function toArray(strg) is suppose to return the following

return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];

this is the line where I'm getting an error code.  The values res[2]
and res[4] are coming back as NaN.  I'm not sure what these values
represent, or why they are Null.

I'm calling the backgroundPosition like this:

$('#nav li')
.css({backgroundPosition: -150px 0px})
.mouseover(function(){
$(this).stop().animate(
{backgroundPosition: 300px 
0px },
{duration:200})
});


my css reads:

#nav li {
background:url(../gfx/btn_navbg.jpg) 0px 0px;

float:right;
min-width: 100px;
max-width: 150px;
margin:0;
padding:0;
text-align:center;
}


Any help would be much appreciated.


[jQuery] Re: Deactivating parent link with JQuery

2009-09-24 Thread osu

That's perfect, thanks for that - the second example works a treat.

osu


On Sep 24, 7:10 pm, Andi23 dowhatyouw...@gmail.com wrote:
 In that case, you can just remove the href attribute of the link(s):
 $(li ul).siblings(a).removeAttr(href);

 or, if you want to leave in the href attribute for future use?, you
 can do this:
 $(li ul).siblings(a).click(function(){
     return false;

 });

 good luck-


[jQuery] Re: IE: Cursor still displays hourglass symbol after unblocking

2009-09-24 Thread elubin

Yes, same problem I posted yesterday... funny we both hit it this
week.   hopefully someone can help??  I know the author of blockUI
says he monitors this forum...

http://groups.google.com/group/jquery-en/browse_thread/thread/9ea1cad2f7bc2535/9edbec1ce17d17f4?hl=enlnk=gstq=hourglass#9edbec1ce17d17f4


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

2009-09-24 Thread Steven

I have a table that looks something like this:

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

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

Can anyone help?


[jQuery] Re: XHTML or HTML when creating elements?

2009-09-24 Thread Richard D. Worth
On Thu, Sep 24, 2009 at 1:36 PM, Bertilo Wennergren berti...@gmail.comwrote:


 The question about br / arose when I was demonstrating
 how the same inline JS example is supposed to look like in HTML
 and in XHTML. When I was changing one version from it's XHTML
 incarnation into an HTML incarnation, removing all the
 ending slashes from meta elements etc., I suddenly stopped
 at the included jQuery code that happend to have a piece
 of '.html(br / whatever...)' in it, suddenly not knowing
 if I'm supposed to remove that slash or not. I really did not
 know - since I'm quite new to jQuery (being in the process of
 converting from Prototype...). So I had to ask. Sorry about
 all the hairs being split in the process!


Not at all. I think it was a fruitful discussion.

- Richard


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

2009-09-24 Thread Charlie Griefer
$('a.accept').click(function() {
alert($(this).closest('tr').attr('id'));
});

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


 I have a table that looks something like this:

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

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

 Can anyone help?




-- 
Charlie Griefer
http://charlie.griefer.com/

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


[jQuery] $(':target') and $(location.hash)

2009-09-24 Thread Jack Bates

$(':target') works in Firefox 3.5, but not Firefox 3.0 and some other
browsers,

http://www.sfu.ca/~jdbates/tmp/qubit/200909231/#aaa

^ in Firefox 3.5, $(':target') selects just the element with id=aaa,
so this element appears blue while the other appears red

In Firefox 3.0 and some other browsers, $(':target') seems to select
all elements? so they all appear blue

$(location.hash) works in Firefox 3.5 and 3.0,

http://www.sfu.ca/~jdbates/tmp/qubit/200909232/#aaa

^ in Firefox 3.5 and 3.0, $(location.hash) selects just the element
with id=aaa, so this element appears blue while the other appears
red

Is the inconsistent behavior of $(':target') in Firefox 3.5 and 3.0 a
bug in jQuery? May I open a ticket?


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

2009-09-24 Thread Steven

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

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

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

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


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

2009-09-24 Thread Charlie Griefer
Steven:

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

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

?

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


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

 On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  $('a.accept').click(function() {
  alert($(this).closest('tr').attr('id'));
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

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


[jQuery] Re: $(':target') and $(location.hash)

2009-09-24 Thread John Resig
jQuery does not support :target. The only reason why it works in Firefox 3.5
is that it provides a native querySelectorAll method. We would have to have
an implementation that works in other browser (FF 3.0, IE 8, etc.) and we
don't have that right now. You're welcome to file a ticket asking for
:target.

--John


On Thu, Sep 24, 2009 at 2:41 PM, Jack Bates jack.ba...@gmail.com wrote:


 $(':target') works in Firefox 3.5, but not Firefox 3.0 and some other
 browsers,

 http://www.sfu.ca/~jdbates/tmp/qubit/200909231/#aaahttp://www.sfu.ca/%7Ejdbates/tmp/qubit/200909231/#aaa

 ^ in Firefox 3.5, $(':target') selects just the element with id=aaa,
 so this element appears blue while the other appears red

 In Firefox 3.0 and some other browsers, $(':target') seems to select
 all elements? so they all appear blue

 $(location.hash) works in Firefox 3.5 and 3.0,

 http://www.sfu.ca/~jdbates/tmp/qubit/200909232/#aaahttp://www.sfu.ca/%7Ejdbates/tmp/qubit/200909232/#aaa

 ^ in Firefox 3.5 and 3.0, $(location.hash) selects just the element
 with id=aaa, so this element appears blue while the other appears
 red

 Is the inconsistent behavior of $(':target') in Firefox 3.5 and 3.0 a
 bug in jQuery? May I open a ticket?


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

2009-09-24 Thread Steven

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

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

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

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

 ?



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

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

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

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

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

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

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


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

2009-09-24 Thread Charlie Griefer
Ah, yeah.  I should have checked to see if you were on 1.3.

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

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

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



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


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

 On Sep 24, 12:59 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  Steven:
 
  It seems to be working here (quick sample thrown together):
 
  http://charlie.griefer.com/getRowID.html
 
  ?
 
 
 
  On Thu, Sep 24, 2009 at 11:55 AM, Steven html...@gmail.com wrote:
 
   I cannot seem to get that to work, although it does make sense. I'm
   using Ajax to load the tables in; I don't know if that is the cause. I
   did try it on a static page and it still did nothing though.
 
   On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
   wrote:
$('a.accept').click(function() {
alert($(this).closest('tr').attr('id'));
 
--
Charlie Grieferhttp://charlie.griefer.com/
 
I have failed as much as I have succeeded. But I love my life. I love
 my
wife. And I wish you my kind of success.
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

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


[jQuery] Using addClass to Highlight Errors

2009-09-24 Thread s.ross

I have what I'm certain amounts to a CSS misunderstanding on my part.
Here's the reduced problem:

CSS

input[type='text'], textarea {
  background-color: #2c2c2c;
  color: white; }

.warning {
  background-color: #851728; }

.error {
  background-color: #8D580F; }

HTML

  body
input type=text id=title /
  /body

jQuery

  var title = jQuery(#title);
  title.addClass('error');

The problem: The addClass does not affect the styling of #title.
Firebug shows .error, but as an empty selector.

Any hints are appreciated. And, BTW, is this an appropriate way to
flag errors -- by adding or removing a class?


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

2009-09-24 Thread Steven

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

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

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

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

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





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

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

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

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

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

   ?

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

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

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

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

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

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

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

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

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


[jQuery] Re: Deactivating parent link with JQuery

2009-09-24 Thread osu

Ok, I have another question that's related to the first.

I need to highlight *only* the top-parent item (the same one I just
ran 'return false;' on) with the class 'nav-selected'.

This is the code that's being generated by the CMS I'm working with
when I click on Link 3a:

ul
li class=nav-path-selecteda href=#Link 1/a/li
lia href=#Link 2/a/li
li class=nav-path-selecteda href=#Link 3/a
ul
lia href=# class=nav-selectedLink 3a/a/li
lia href=#Link 3b/a/li
lia href=#Link 3c/a/li
/ul
/li
lia href=#Link 4/a/li
/ul

I've got this:

if($(#nav li:first).hasClass(nav-path-selected).siblings(a))
  // Add nav-selected class to parent li with children
  $(.nav-path-selected).addClass(nav-selected);
};

But it's not working for me. I'm *only* trying to affect the parent
li of the list that has a child a active in it.

Do you know how I can do that? Thanks for all your help so far, really
is appreciated.

osu



On Sep 24, 8:18 pm, osu onesiz...@googlemail.com wrote:
 That's perfect, thanks for that - the second example works a treat.

 osu

 On Sep 24, 7:10 pm, Andi23 dowhatyouw...@gmail.com wrote:

  In that case, you can just remove the href attribute of the link(s):
  $(li ul).siblings(a).removeAttr(href);

  or, if you want to leave in the href attribute for future use?, you
  can do this:
  $(li ul).siblings(a).click(function(){
      return false;

  });

  good luck-


[jQuery] Re: Using addClass to Highlight Errors

2009-09-24 Thread Bertilo Wennergren


s.ross wrote:


I have what I'm certain amounts to a CSS misunderstanding on my part.
Here's the reduced problem:

CSS

input[type='text'], textarea {
  background-color: #2c2c2c;
  color: white; }

.warning {
  background-color: #851728; }

.error {
  background-color: #8D580F; }

HTML

  body
input type=text id=title /
  /body

jQuery

  var title = jQuery(#title);
  title.addClass('error');

The problem: The addClass does not affect the styling of #title.
Firebug shows .error, but as an empty selector.


Indeed. Lose the quotation marks in the CSS:

 .warning {
   background-color: #851728; }

 .error {
   background-color: #8D580F; }

But it still won't work. Those rules are too weak.
The basic rule has greater specificity, and wins.

If you change the rules to this, they will be stronger,
and win out:

 input.warning {
   background-color: #851728; }

 input.error {
   background-color: #8D580F; }

This will also work:

body .warning {
   background-color: #851728; }

body .error {
   background-color: #8D580F; }


Any hints are appreciated. And, BTW, is this an appropriate way to
flag errors -- by adding or removing a class?


It's a very good way indeed. I use it all the time.

--
Bertilo Wennergren http://bertilow.com


[jQuery] Re: Using addClass to Highlight Errors

2009-09-24 Thread s.ross


On Sep 24, 12:26 pm, Bertilo Wennergren berti...@gmail.com wrote:
 s.ross wrote:
  I have what I'm certain amounts to a CSS misunderstanding on my part.
  Here's the reduced problem:

  CSS

  input[type='text'], textarea {
    background-color: #2c2c2c;
    color: white; }

  .warning {
    background-color: #851728; }

  .error {
    background-color: #8D580F; }

  HTML

    body
      input type=text id=title /
    /body

  jQuery

    var title = jQuery(#title);
    title.addClass('error');

  The problem: The addClass does not affect the styling of #title.
  Firebug shows .error, but as an empty selector.

 Indeed. Lose the quotation marks in the CSS:

   .warning {
     background-color: #851728; }

   .error {
     background-color: #8D580F; }

 But it still won't work. Those rules are too weak.
 The basic rule has greater specificity, and wins.

 If you change the rules to this, they will be stronger,
 and win out:

   input.warning {
     background-color: #851728; }

   input.error {
     background-color: #8D580F; }

 This will also work:

 body .warning {
     background-color: #851728; }

 body .error {
     background-color: #8D580F; }

  Any hints are appreciated. And, BTW, is this an appropriate way to
  flag errors -- by adding or removing a class?

 It's a very good way indeed. I use it all the time.

 --
 Bertilo Wennergren http://bertilow.com

Thanks so much. I knew it had to do with specificity, but it wasn't
clear what the fix was. CSS blindness :)


[jQuery] Re: IE: Cursor still displays hourglass symbol after unblocking

2009-09-24 Thread Mike Alsup

 Yes, same problem I posted yesterday... funny we both hit it this
 week.   hopefully someone can help??  I know the author of blockUI
 says he monitors this forum...


Will take a look at this tonight.  Thanks for the reminder.

Mike


[jQuery] Add content

2009-09-24 Thread a1anm

Hi,

I have an unordered list and I would like to use Jquery to add some
li's to it.

How do I do this?

Thanks!


[jQuery] Re: Add content

2009-09-24 Thread Charlie Griefer
On Thu, Sep 24, 2009 at 2:03 PM, a1anm alanmoor...@gmail.com wrote:


 Hi,

 I have an unordered list and I would like to use Jquery to add some
 li's to it.

 How do I do this?

 Thanks!


http://docs.jquery.com/Manipulation/append

-- 
Charlie Griefer
http://charlie.griefer.com/

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


[jQuery] Auto close dialog after 5 seconds ?

2009-09-24 Thread spstieng

Hi. I'm using jQuery.dialog and I'm wondering if it's possible to auto
close it after e.g. 5 seconds.


[jQuery] tab load and dequeue

2009-09-24 Thread richajax


Hi guys,

I am relatively new to jquery and using jquery tab to one of the
page.
The tab contains 3 tab, and each tab contains pretty heavy dom
instead.
When I toggle the tab, I noticed about a 2 second delay, and wondered
why there is such a delay.
so.. run the profiler in the IE developer tool, and noticed that most
of the bottleneck was on dequeue in load function of the ui.tab.  I
looked at what it does, and was bit confusing why
element.dequeue(tabs) causes such a delay ?

Is this general limitation of tab.ui ?? can it be simple show, and
hide tabs - I believe this would be bit more faster ??

Richard K


[jQuery] Re: Auto close dialog after 5 seconds ?

2009-09-24 Thread Charlie





within the event that opens the dialog you could include a timeout for
close :

setTimeout($('dialog').dialog("close"),5000);

spstieng wrote:

  Hi. I'm using jQuery.dialog and I'm wondering if it's possible to auto
close it after e.g. 5 seconds.

  






[jQuery] Re: Unlock Documentation

2009-09-24 Thread Scott Haneda


Sure.  I am totally new to jQ, so probably a food candidate to answer  
some of these.


http://docs.jquery.com/Plugins/Validation/validate
That through me for a loop, is this an internal feature built into jQ,  
or something I need to reference as a plugin?  I can not find an  
official answer to this.  (thank you #jquery, I am clear on this now)


It looks like there is a lot of data here:
http://bassistance.de/jquery-plugins/jquery-plugin-validation/ and  
that MS is hosting the files, but it is not at all clear to me if this  
is officially supported.


I do not want to go into a lot of detail on that one... I used the  
milk demo as a learning base, but comparing the way that code is  
done, to the way the docs show it, is different enough that I was  
confused.  The docs do not explain why the demo is done one way, and  
the docs illustrate another.  This could just be me, not understanding  
enough of this.  So forgive me if I am way off base.


http://docs.jquery.com/Events/keypress
I spent a lot of time trying to get something like the above to work  
reliably.  The demo does not work with the delete key.  It is not  
clear if that is expected behavior, or a bug.


Unfortunately, I would have to go through each function to remember  
where I ran into a little glitch.  There are a good deal of little  
things like this that I run into:

http://docs.jquery.com/Effects/hide
I am on the demo part for hide() and click on Click to hide me too,  
the page jumps and then Hiya.Such interesting text, eh? shows up.   
That does not seem like a good hide example to me.  At least, not  
distilled down to the core example that I may want to see in order to  
understand what it does.  Looking at the source of the demo, I do not  
really understand, we have a click that creates a button, and then a  
button that does the hiding.


Duh, ok, I get it, the page jumped, and I was now in a different  
demo.  I am on a laptop, so this may not be a perfect case for your to  
replicate.  Though this is very illustrative of the type of confusion  
I run into at times.


Loving jQ, and this is in no way a knock on it, and my post was mostly  
in regards to the form validation stuff, which I do feel the docs need  
worked over.  The rest was more a comment about the OP stating that  
the docs were not wiki style editable, which you have proven to not be  
the case.  Thank you.

--
Scott * If you contact me off list replace talklists@ with scott@ *

On Sep 24, 2009, at 1:48 AM, Jörn Zaefferer wrote:



As Karl mentioned, users registered for more then 24h can edit all
pages, with just a few exceptions, like the wiki homepage and the
About page.

So, could you guys be a bit more specific with your critique of
existing documentation?

Jörn

On Thu, Sep 24, 2009 at 7:57 AM, Scott Haneda talkli...@newgeo.com  
wrote:


Wow, I thought I was the only one.  Has anyone looked at the form  
validation

docs?  I thought it was a wiki style though?  No one can edit?
--
Scott * If you contact me off list replace talklists@ with scott@ *

On Sep 23, 2009, at 9:21 PM, rickoshay wrote:

The documentation is going to remain in its sorry state if they do  
not
unlock it and allow competent technical writers to update it.  
There is

no excuse, for example, for not describing the copy/move behavior of
the append function. One in a mountain of necessary documentation
updates.






[jQuery] creating parameters dynamically

2009-09-24 Thread macsig

I know this is not strictly related to jquery but I don't know how to
make it works.

I'm working on a function that has as variable an array and for each
element I need to create a piece of code for an other function.

For instance when the array contains [0,1,2] I need to call

$(this).tablesorter({headers: {0: { sorter: false }, 1: { sorter:
false }, 2: { sorter: false }}});


and when the array contains [0,4,5,8] I need to call

$(this).tablesorter({headers: {0: { sorter: false }, 4: { sorter:
false }, 5: { sorter: false }, 8: { sorter: false }}});


How can I achieve so?

THANKS, I appreciate your help

Sig


[jQuery] Re: Jquery and Pop up blockers

2009-09-24 Thread SEMMatt2

What do they call those windows that open up without any browser
controls?

Thanks

On Sep 24, 8:33 am, Mike McNally emmecin...@gmail.com wrote:
 If you're not popping up new browser windows then you shouldn't have
 to worry about popup blockers, and it has nothing to do with what
 Javascript library you're using.

 On Wed, Sep 23, 2009 at 8:40 PM, SEMMatt2 mattluk...@gmail.com wrote:

  Does Jquery perform better or worse than other Java library with
  regard to not triggering pop up blockers?

  Thank you.

 --
 Turtle, turtle, on the ground,
 Pink and shiny, turn around.


[jQuery] ultimate submenu(please help me)

2009-09-24 Thread hamed7

hi
i want create ultimate submenu and support multilevel for example like
this:
--
1:
1-1

2:
2-1
2-2-1
2-3-1-1
2-3-2-1
2-4-1-1-1
2-5-1-1

3:
3-1-1-1

4
---
i need some idea or some sourcecode(ajax sourcecode is better than
none ajax)
*please help me this is important for me very much.


[jQuery] Prev and next navigation

2009-09-24 Thread Anush Shetty

I am trying to a setup a jquery based navigation for my photo gallery
i.e something like facebook using hash url technique. I am using php
and mysql in the backend. Is there any example I could look at for
implementing it. The reason for using hash urls is that I would like
to have an unique url for every pic.



-- 
Sent from my mobile device

Anush,
Team Gluster,
http://gluster.com


[jQuery] Re: ultimate submenu(please help me)

2009-09-24 Thread Shawn


Superfish doesn't do the trick? 
http://users.tpg.com.au/j_birch/plugins/superfish/#examples


They show the JS code to make that work.  View Source on the page and 
you find the menus are just lists (ul's).  So if you need more complex, 
just build the nested lists as needed.  If you need Ajaxified, just 
update the lists as needed.  (though you may need to re-apply the 
superfish command then).


Shawn

hamed7 wrote:

hi
i want create ultimate submenu and support multilevel for example like
this:
--
1:
1-1

2:
2-1
2-2-1
2-3-1-1
2-3-2-1
2-4-1-1-1
2-5-1-1

3:
3-1-1-1

4
---
i need some idea or some sourcecode(ajax sourcecode is better than
none ajax)
*please help me this is important for me very much.


[jQuery] Re: Validate Text Field onblur (Bassistance Validation Plugin)

2009-09-24 Thread Loony2nz

do you have an example of this somehwere?  I think I could use this
for upcoming forms I have in my pipeline.

Thanks!

On Sep 1, 10:33 am, Dave Buchholz - I-CRE8 off...@i-cre8.com wrote:
 Got it, this code onfocusout: function(element) { this.element
 (element); }, gives me what I am looking for

 Dave Buchholz


  1   2   >