Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Klaus Hartl
Andrea Ercolino schrieb:
> mea culpa
> I made a 'mistake': I put in the loop an accessor $( ".class" ) that caused
> the abnormal delay. 
> After saving the reference $class = $( ".class" ) before entering the loop,
> the delay has lowered to 78 milliseconds in IE7 AND 78 milliseconds in
> FF1.5.0.8: unbelievable!

If you know the type of your element, you can make the query a little 
faster:

$('div.class')

And if you know the context, even more: $('div.class', aDOMNode)

Also, as an alternative to Mike's excellent solution (once again), if 
you have to create similiar structures a lot of times you can create one 
template and use clone() later on, its slightly faster then 
createElement (but still not as fast as Array.join() plus innerHTML)...

Here are some interesting benchmarks with all the different techniques:
http://www.quirksmode.org/dom/innerhtml.html


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Dismissing Menus

2006-11-12 Thread Blair McKenzie
It depends on the underlying html structure of the menu. The simplest is to use nested lists with the hover(fn,fn) method jQuery provides. hover will trigger the first function when the mouse enters an element, and the second function when it leaves.
BlairOn 11/13/06, Alan Gutierrez <[EMAIL PROTECTED]> wrote:
Using jQuery. First day.After you've displayed a menu, what event would you recommend todismiss the menu?Should I listen for click and scroll on the document and hide themenu if it is clicked elsewhere? How do I distinguish between clicks
inside and outside of the menu body. It's been a long time sinceI've read through the various event routing strategies of thedifferent browsers. I'm hoping there is a cross-platform recipe thatis now common knowledge.
For now, I'm adding a cancel link to the menu.--Alan Gutierrez - 504 717 1428 - [EMAIL PROTECTED] - http://blogometer.com/
Think New Orleans - http://thinknola.com/___jQuery mailing listdiscuss@jquery.com
http://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] click event not working??

2006-11-12 Thread leftend

Aha!  Right you are.  That makes so much sense I can't believe I didn't think
of it before, thanks Erik!

I tried moving the code that attaches the events into a seperate function
that I call *after* the thickbox is created - but the "click" event only
worked on the first element in the thickbox - but not on the other two
following it.  This seems like it would work to me, but maybe it's a race
condition?  Any thoughts?  Here's the function that I call after the
thickbox is created and displayed:

function doBinding()
{
$("#lnkForgot").click(function() {
$("#divForgot").slideDown(500);
return false;
});
$("#lnkCancelForgot").click(function() {
$("#divForgot").slideUp(500);
return false;
});
$("btnLoginButton").click(function() {
$("#hdnMode").val("login");
});
}

For those familiar with ASP.NET, any ideas on a different way of doing this
(other than having the content hidden elsewhere on the page like I'm doing
now)?  As far as I can tell, I can't go and grab the html from another ASPX
page and display it - because then I would have a nested form tag. 
Currently, I'm creating a form in a User Control, then I include the user
control on a page and hide it.  When the user clicks the login link, I
display that form in the thickbox.

Thanks,
Chad


Erik Beeson wrote:
> 
> Without even looking at the code, I would guess you're using the thickbox
> to
> display content that you have elsewhere on the page? If so, that would be
> the source of the problem. Cody's thickbox shows a copy of the elements
> for
> displaying inline, and the event handlers aren't applied to the copies. I
> ran in to this exact same thing trying to do a login box. Possible
> solutions
> are: use a different light box, hack up the thickbox code, or have your
> login page be a separate page that the thickbox loads through an iframe.
> 
> --Erik
> 
> On 11/11/06, leftend <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hello, I'm running into a case where the "click" event is not working on
>> one
>> of my pages.  The strange thing is that I know the code is alright,
>> because
>> I've pulled it out and used it on test pages.  It's kind of hard to
>> explain,
>> so I'll jump right to a url:
>>
>> http://www.the-in.com/dev/Learn_UserProfile.aspx
>>
>> If you click the "Login" link in the upper-right - I'm successfully
>> popping
>> up a thickbox with a login form in it.  My main question revolves around
>> the
>> "Forgot your password?" link in the thickbox.  When you click on it, it
>> should slide down a hidden div that allows you to get your password - but
>> no
>> dice...
>>
>> Here's what the link looks like:
>> # Forgot your password?
>>
>> And here's where I wire up the click event:
>> $(document).ready(function() {
>> $("#lnkForgot").click(function() {
>> $("#divForgot").slideDown(500);
>> });
>> });
>>
>> Because this same code has worked in my test pages, I would guess the
>> issue
>> lies with some other js/html on the page, but I'm not sure how.  But then
>> again, thickbox is working fine... so maybe not?
>>
>> Please help!!
>>
>> Thanks,
>> Chad
>> --
>> View this message in context:
>> http://www.nabble.com/click-event-not-working---tf2612228.html#a7290742
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/click-event-not-working---tf2612228.html#a7311920
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Dismissing Menus

2006-11-12 Thread Alan Gutierrez
Using jQuery. First day.

After you've displayed a menu, what event would you recommend to
dismiss the menu?

Should I listen for click and scroll on the document and hide the
menu if it is clicked elsewhere? How do I distinguish between clicks
inside and outside of the menu body. It's been a long time since
I've read through the various event routing strategies of the
different browsers. I'm hoping there is a cross-platform recipe that
is now common knowledge.

For now, I'm adding a cancel link to the menu.

--
Alan Gutierrez - 504 717 1428 - [EMAIL PROTECTED] - http://blogometer.com/
Think New Orleans - http://thinknola.com/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Interface Sortables onchange property

2006-11-12 Thread Rich Manalang
Hi.  I'm trying to fire off an alert (testing) during a sortables onchange event.  Here's my code:var personalizeHPTabs = function() {    alert('hi... I'm here');};var triggerHPTabsPersonalization = function() {
    $('ul.hptabs-sortable').Sortable( {   accept : 'hptab-sort-item',   helperclass : 'sorthelper',   opacity: 0.8,   fx: 200,  tolerance: 'intersect',      axis: 'vertically',
      onchange: personalizeHPTabs   })}The weird thing is it never fires for the onchange property... I did get it to fire on the onStop, but I only want it to trigger when a change actually occurs.  Any ideas?
Rich
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] What tool is used to compress JQuery?

2006-11-12 Thread Andrea Ercolino

http://dean.edwards.name/packer/


howachen wrote:
> 
> Hi all,
> 
> May I know which tool is used to compress JQuery?
> 
> I found this kind of tool is very useful and can use it?
> 
> Thanks.
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-tool-is-used-to-compress-JQuery--tf2619867.html#a7311246
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] What tool is used to compress JQuery?

2006-11-12 Thread howard chen
Hi all,

May I know which tool is used to compress JQuery?

I found this kind of tool is very useful and can use it?

Thanks.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Andrea Ercolino

mea culpa
I made a 'mistake': I put in the loop an accessor $( ".class" ) that caused
the abnormal delay. 
After saving the reference $class = $( ".class" ) before entering the loop,
the delay has lowered to 78 milliseconds in IE7 AND 78 milliseconds in
FF1.5.0.8: unbelievable!

you can save references to your objects, making it very fast to get to those
objects later
Thanks Michael, "save references" was the key! 
It's only a pity that I had to dig in jQuery (Firebug) to find it out (I saw
your post just before posting this "mea culpa") 

BTW: 
while digging I saw that the same jquery object gets through some code
patterns many times, or at least it's what that looked to me. Also I was
surprised seeing that array copying is done as "b = merge( a, [] )" in place
of "b = a.concat();": shouldn't the latter be faster?



Michael Geary wrote:
> 
>> From: Andrea Ercolino
>> 
>> I have got an array of 50 urls templates, and want to make a 
>> proper url out of each one, adding also a special click, and 
>> then append all these urls to a div in a specific position. 
>> All this should be done many times in a page, "many" could be 
>> 50, just to say something that could be possible, but it's 
>> really an unpredictable number of times. (well, less than a 
>> 100 is a good guess)
>> 
>> I think the problem lies in the dom creation. 
>> Each link is inside 4 nested divs, so this could mean 80 
>> bytes each (adding structure and data).
>> At only 3 divs ( x 50 = 150 appends ) I'm experimenting a 
>> delay of a couple of seconds for reloading the page, and for 
>> this test the page has no content other than those divs!
> 
> Yeah, all that DOM creation will take a while - especially if you use a
> convenience plugin like mine.
> 
> I get much better performance across browsers with [].join('') and
> innerHTML.
> 
> Here's a design pattern I use all the time. I threw in some arbitrary divs
> and spans to show how the nesting works out.
> 
> // Return HTML rendering for an array of strings
> function renderAll( array ) {
> var inner = [];
> for( var i = 0, len = array.length;  i < len;  i++ ) {
> inner[inner.length] = renderOne( array[i], i );
> }
> 
> return [
> '',
> '',
> inner.join(''),
> '',
> ''
> ].join('');
> }
> 
> // Return HTML rendering for a string item
> function renderOne( item, i ) {
> return [
> '',
> '',
> item,
> '',
> ''
> ].join('');
> }
> 
> A test call could be:
> 
> $('#testdiv').html( renderAll( [ 'one', 'two', 'three' ] ) );
> 
> This same basic pattern works for tables, or anything where you have
> nested
> and repeated elements. It works in just about any browser - even very old
> ones, thanks to the use of inner[inner.length] instead of inner.push().
> And
> it's very fast - much faster than the same DOM operations.
> 
> Obviously you could replace the [].join('') with ordinary string
> concatenation, but the array join is faster on most browsers.
> 
> The one big drawback is that you don't automatically get references to the
> objects you're creating. With DOM creation, you can save references to
> your
> objects, making it very fast to get to those objects later. To make up for
> this, you can assign unique IDs in the HTML code as the example does.
> 
> Obviously you could extend this all sorts of ways. In my actual code, the
> "item" is usually an object and not a string, and the renderOne function
> builds up HTML from that object's properties.
> 
> -Mike
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-add-a-js-array-of-jquery-objects-to-a-jquery-object--tf2614381.html#a7310880
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Appending new option object into existing select in IE

2006-11-12 Thread Brandon Aaron
You can just append straight html to a select element in IE with the
latest version of jQuery.

$('#propinsi').append('TestTest2');

--
Brandon Aaron

On 11/12/06, Donny Kurnia <[EMAIL PROTECTED]> wrote:
> In my previous email, I'm asking how to appending new options object
> into existing select, and now I've found the solution.
>
> This is my previous code:
> //--
> $("#propinsi").change(function () {
>   $(".loader").css("display","inline");
>   $.get("somefile.php", {parameter : someparameter}, function (r) {
> //remove previous element but keep the first ones
> $("#kota").children().gt(0).remove();
> var options = $("option",r);
> for (var i=0; i   //get new option attribute
>   var value = options[i].getAttribute("value");
>   var label = options[i].getAttribute("label");
>   //create new option Object
>   var newoption = new Option(label, value);
>   //append it into existing select
>   $("#kota").append(newoption);
> }
> $(".loader").css("display","none");
>   } );
> } );
> //--
> The problem I had that in Firefox, this code works perfectly. In IE6, I
> got select but the label didn't appear. The value somehow appear and
> submitted by form correctly.
>
> I tried this method to add the new options object. I got it from some
> thread in this mailling list:
> //--
>   var optn = document.createElement("OPTION");
>   optn.text = label;
>   optn.value = value;
>   $("#kota").append(optn);
> //--
> but it still didn't work in IE6.
>
> When I lookup my old works (around 3 years ago), I had this solution:
> //--
>   $('#kota')[0].options[i+1]=newoption;
> //--
>
> And it's works like magic, do the right things in FF and IE6. The
> complete code is like this:
> //--
> $("#propinsi").change(function () {
>   $(".loader").css("display","inline");
>   $.get("somefile.php", {parameter : someparameter}, function (r) {
> //remove previous element but keep the first ones
> $("#kota").children().gt(0).remove();
> var options = $("option",r);
> for (var i=0; i   //get new option attribute
>   var value = options[i].getAttribute("value");
>   var label = options[i].getAttribute("label");
>   //create new option Object
>   var newoption = new Option(label, value);
>   //append it into existing select
>   $('#kota')[0].options[i+1]=newoption;
> }
> $(".loader").css("display","none");
>   } );
> } );
> //--
> Tested well in IE6, FF 1.5, and Opera 9 running on WinXP SP2
>
> FYI:
> AJAX call to file somefile.php will return a result in XML like this:
> 
>   
>   
> 
>
> Hope this code help. If anyone interesting turning this code into
> plugins, you're welcome ;)
>
> --
> Donny Kurnia
> http://hantulab.blogspot.com
> http://hantulab.multiply.com
>
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Appending new option object into existing select in IE

2006-11-12 Thread Donny Kurnia
In my previous email, I'm asking how to appending new options object
into existing select, and now I've found the solution.

This is my previous code:
//--
$("#propinsi").change(function () {
  $(".loader").css("display","inline");
  $.get("somefile.php", {parameter : someparameter}, function (r) {
//remove previous element but keep the first ones
$("#kota").children().gt(0).remove();
var options = $("option",r);
for (var i=0; i
  
  


Hope this code help. If anyone interesting turning this code into
plugins, you're welcome ;)

--
Donny Kurnia
http://hantulab.blogspot.com
http://hantulab.multiply.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread ashutosh bijoor
HiI know its a bit too late, but nevertheless, there is a plugin that may save you some future headache. The Form De-serialize plugin does what you need and a bit more. You can pass a JSON data structure (hash) to the deserialize plugin and it goes and sets / resets the values of all elements of the form.
The plugin is listed in jquery.com/pluginsRegardsAshutoshOn 11/11/06, Truppe Steven <
[EMAIL PROTECTED]> wrote:Hello,i need a function that goes through all elements of my form and removes
the content of my textfields/inputs. Is there a way of doing this with ajQuery oneliner ?best regards,Truppe Steven___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Michael Geary
> From: Andrea Ercolino
> 
> I have got an array of 50 urls templates, and want to make a 
> proper url out of each one, adding also a special click, and 
> then append all these urls to a div in a specific position. 
> All this should be done many times in a page, "many" could be 
> 50, just to say something that could be possible, but it's 
> really an unpredictable number of times. (well, less than a 
> 100 is a good guess)
> 
> I think the problem lies in the dom creation. 
> Each link is inside 4 nested divs, so this could mean 80 
> bytes each (adding structure and data).
> At only 3 divs ( x 50 = 150 appends ) I'm experimenting a 
> delay of a couple of seconds for reloading the page, and for 
> this test the page has no content other than those divs!

Yeah, all that DOM creation will take a while - especially if you use a
convenience plugin like mine.

I get much better performance across browsers with [].join('') and
innerHTML.

Here's a design pattern I use all the time. I threw in some arbitrary divs
and spans to show how the nesting works out.

// Return HTML rendering for an array of strings
function renderAll( array ) {
var inner = [];
for( var i = 0, len = array.length;  i < len;  i++ ) {
inner[inner.length] = renderOne( array[i], i );
}

return [
'',
'',
inner.join(''),
'',
''
].join('');
}

// Return HTML rendering for a string item
function renderOne( item, i ) {
return [
'',
'',
item,
'',
''
].join('');
}

A test call could be:

$('#testdiv').html( renderAll( [ 'one', 'two', 'three' ] ) );

This same basic pattern works for tables, or anything where you have nested
and repeated elements. It works in just about any browser - even very old
ones, thanks to the use of inner[inner.length] instead of inner.push(). And
it's very fast - much faster than the same DOM operations.

Obviously you could replace the [].join('') with ordinary string
concatenation, but the array join is faster on most browsers.

The one big drawback is that you don't automatically get references to the
objects you're creating. With DOM creation, you can save references to your
objects, making it very fast to get to those objects later. To make up for
this, you can assign unique IDs in the HTML code as the example does.

Obviously you could extend this all sorts of ways. In my actual code, the
"item" is usually an object and not a string, and the renderOne function
builds up HTML from that object's properties.

-Mike


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Karl Swedberg

On Nov 12, 2006, at 4:57 PM, Dave Methvin wrote:

>> Not to complicate matters, but wouldn't "input:hidden"
>> do the same thing as "[EMAIL PROTECTED]" ?
>
> No, input:hidden would retrieve elements with type!="hidden" but with
> display:none or visibility:hidden. That's not totally bulletproof,  
> though,
> because some parent of the input element could have display:none  
> and it
> would still be selected even though the user can't see it.

Ah, yes, of course! Thanks, Dave, for clarifying. :)

Karl

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


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Andrea Ercolino

I just put a time start / end probes and found that each 50 times append loop
eats up almost 500 milliseconds. 
Between 465 and 515 on IE7 and between 500 and 575 on FF1.5.0.8
This means that a page with 10 loops, needs 5 seconds to end displaying!!
AND I was wrong before, each link is inside 2 divs, not 4.


Andrea Ercolino wrote:
> 
> I have got an array of 50 urls templates, and want to make a proper url
> out of each one, adding also a special click, and then append all these
> urls to a div in a specific position. All this should be done many times
> in a page, "many" could be 50, just to say something that could be
> possible, but it's really an unpredictable number of times. (well, less
> than a 100 is a good guess)
> 
> I think the problem lies in the dom creation. 
> Each link is inside 4 nested divs, so this could mean 80 bytes each
> (adding structure and data).
> At only 3 divs ( x 50 = 150 appends ) I'm experimenting a delay of a
> couple of seconds for reloading the page, and for this test the page has
> no content other than those divs!
> 
> 
> dave.methvin wrote:
>> 
>>> I've got a jquery script where I append (one by one) 50 new
>>> jquery objects to another jquery object, but it's taking way 
>>> too much time, so I thought that it could be faster if I make
>>> an array buffer out of them and then aggregate the array
>>> as a whole, but I don't find out how to do it.
>> 
>> Can you provide a little more detail about how you end up with 50 jQuery
>> objects that you need to combine?
>> 
>> 
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-add-a-js-array-of-jquery-objects-to-a-jquery-object--tf2614381.html#a7309457
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] if/then equivalents in jQuery

2006-11-12 Thread Blair McKenzie
Is there any reason you can't simply do the client-side validation on params before the post and wrap the post in a simple 'if' statement with the result as the condition?Blair
On 11/12/06, Bruce MacKay <[EMAIL PROTECTED]> wrote:


Hi folks,
I'm hoping someone might paint me a picture of how to use jQuery's
equivalent of if/then conditional statements - or how to arrange jQuery
code to allow for such.
I have the following code which collects information from an email form
and sends it to the server for processing.  If the form information
is complete, the email is sent, and the client-side form has the values
of its textarea element set to nothing, and the form itself is made to
disappear.
My problem is that if the form is not sent for some reason (e.g. a valid
address is not given), I don't want the textarea element to be reset or
the form hidden. 
Can someone please give me a conceptual framework/(pseudo-code) example
of how to approach this situation?
Thanks,
Bruce
The code below is how I am achieving the first scenario (when the
information from the email form is all OK and the email is sent after
server-side processing)
$.fn.ajaxSubmitEmail = function(e) {this.submit(function(){ var
params = {}; $(this) .find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'],
[EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED], textarea")
.filter(":enabled") .each(function() { params[ this.name ||
this.id || 
this.parentNode.name || this.parentNode.id ] = this.value;
});$("div#indicate").show();
$.post(this.getAttribute("action"), params,
function(text){
    $("div#indicate").hide();
    $('textarea', "emailform").val('');
    $("div#email").slideUp('fast'); 
   
$("div#thereply").html(text).slideDown('slow').highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'});
    }); return false; });}


___jQuery mailing listdiscuss@jquery.com
http://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Andrea Ercolino

I have got an array of 50 urls templates, and want to make a proper url out
of each one, adding also a special click, and then append all these urls to
a div in a specific position. All this should be done many times in a page,
"many" could be 50, just to say something that could be possible, but it's
really an unpredictable number of times. (well, less than a 100 is a good
guess)

I think the problem lies in the dom creation. 
Each link is inside 4 nested divs, so this could mean 80 bytes each (adding
structure and data).
At only 3 divs ( x 50 = 150 appends ) I'm experimenting a delay of a couple
of seconds for reloading the page, and for this test the page has no content
other than those divs!


dave.methvin wrote:
> 
>> I've got a jquery script where I append (one by one) 50 new
>> jquery objects to another jquery object, but it's taking way 
>> too much time, so I thought that it could be faster if I make
>> an array buffer out of them and then aggregate the array
>> as a whole, but I don't find out how to do it.
> 
> Can you provide a little more detail about how you end up with 50 jQuery
> objects that you need to combine?
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-add-a-js-array-of-jquery-objects-to-a-jquery-object--tf2614381.html#a7308883
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Element tagName

2006-11-12 Thread Dave Methvin
> Hmm... Using the same name makes it confusing. 
> Do I use parens after tagName or not?  

That part of the answer is easy. The jQuery object only has one named
property that you would normally use, .length. You might also use its
array-like properties, [0], [1],  etc. Everything else is a method. 


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Dave Methvin
 
> Not to complicate matters, but wouldn't "input:hidden"
> do the same thing as "[EMAIL PROTECTED]" ?

No, input:hidden would retrieve elements with type!="hidden" but with
display:none or visibility:hidden. That's not totally bulletproof, though,
because some parent of the input element could have display:none and it
would still be selected even though the user can't see it.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Element tagName

2006-11-12 Thread Dave Methvin
 
> I'm of the opinon that .attr() should _not_ be getting
> properties of an element unless it is to normalize
> attributes like disabled and selected that become 
> properties after render.

I don't think that's the way it works today, but I agree it would be good to
analyze the current state of the jQuery API and see if things are
consistent. Perhaps we have an opportunity to remove some things and make
the API more consistent at the same time. As Steven Truppe said, the
difference between $("div").tag() and $("div")[0].tagName isn't very much;
the latter is much more clear about what it is doing and we get it for free.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How do I add a js array of jquery objects to a jqueryobject?

2006-11-12 Thread Dave Methvin
> I've got a jquery script where I append (one by one) 50 new
> jquery objects to another jquery object, but it's taking way 
> too much time, so I thought that it could be faster if I make
> an array buffer out of them and then aggregate the array
> as a whole, but I don't find out how to do it.

Can you provide a little more detail about how you end up with 50 jQuery
objects that you need to combine?


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] dimensions.js breaks height function?

2006-11-12 Thread Brandon Aaron
The dimensions plugin has moved to the plugins repository and the
latest version there fixes the height issue. Also the offset method
will work without the dimensions plugin.

--
Brandon Aaron

On 11/12/06, PragueExpat <[EMAIL PROTECTED]> wrote:
>
> Please advise: I need to use dimensions.js for the offset function. However,
> since this file overwrites JQuery's height function, I can no longer set
> heights (-- i.e. $("p").height("20px"); --).  Will the offset function work
> on all browsers if I strip out dimensions' height function? Does anyone know
> the plan for dimensions.js? Will the 2 height functions somehow be merged?
> Thanks for any help...
> --
> View this message in context: 
> http://www.nabble.com/dimensions.js-breaks-height-function--tf2618104.html#a7306339
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] dimensions.js breaks height function?

2006-11-12 Thread Klaus Hartl
PragueExpat schrieb:
> Please advise: I need to use dimensions.js for the offset function. However,
> since this file overwrites JQuery's height function, I can no longer set
> heights (-- i.e. $("p").height("20px"); --).  Will the offset function work
> on all browsers if I strip out dimensions' height function? Does anyone know
> the plan for dimensions.js? Will the 2 height functions somehow be merged?
> Thanks for any help...

Once again I think plugins shouldn't alter jQuery's source. The word 
"plugin" - at least to me - suggests that you can use it right away 
without having to worry about anything.

Maybe scripts that alter jQuery should not be called plugin and 
extension instead, whatever.

I for example will not use the dimensions plugin for that reason, 
because I don't want to work a day on fixing Plazes (which is a shame 
because it is good).


-- Klaus




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] dimensions.js breaks height function?

2006-11-12 Thread PragueExpat

Please advise: I need to use dimensions.js for the offset function. However,
since this file overwrites JQuery's height function, I can no longer set
heights (-- i.e. $("p").height("20px"); --).  Will the offset function work
on all browsers if I strip out dimensions' height function? Does anyone know
the plan for dimensions.js? Will the 2 height functions somehow be merged?
Thanks for any help...
-- 
View this message in context: 
http://www.nabble.com/dimensions.js-breaks-height-function--tf2618104.html#a7306339
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] new jQuery API draft

2006-11-12 Thread Yehuda Katz
No problem :-D It's pretty much identical to the @param attribute.-- YehudaOn 11/12/06, Jörn Zaefferer <
[EMAIL PROTECTED]> wrote:Yehuda Katz schrieb:> Great Job! This'll give me some impetus to update Visual jQuery ;)
I still need to add the new option element, I'll take a peek at yourstylesheet for that :-)--Jörn Zaeffererhttp://bassistance.de___
jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/-- Yehuda Katz
Web Developer | Wycats Designs(ph)  718.877.1325
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Custom request headers

2006-11-12 Thread Choan C. Gálvez
Hi all.

The "server people" I work with insists in the necessity of sending
custom headers in AJAX requests, so I've modified my copy of jQuery
and opened a bug report (feature request, obviously) which includes a
patch proposal.



-- 
Choan


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Element tagName

2006-11-12 Thread Brandon Aaron
On 11/11/06, Dave Methvin <[EMAIL PROTECTED]> wrote:
> > I couldn't find a way using jQuery to get the
> > tagName of an element
>
> I immediately thought of .attr("tagName") but it didn't work. Some paths
> through .attr() get both properties and attributes, others just attributes,
> others just properties. Any time there is an entry in the fix object, it
> gets properties _only_, so one way to support getting tagName would be to
> add an entry to fix.

I'm of the opinon that .attr() should _not_ be getting properties of
an element unless it is to normalize attributes like disabled and
selected that become properties after render.

--
Brandon Aaron

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Karl Swedberg
On Nov 12, 2006, at 12:26 PM, Jörn Zaefferer wrote:

> That is true, but again another ambiguitiy. If you want to select  
> input
> elements of type hidden, :hidden will also select other elements that
> are not visible. In that case, you have to fallback to input 
> [EMAIL PROTECTED]

Not to complicate matters, but wouldn't "input:hidden" do the same  
thing as "[EMAIL PROTECTED]" ?
___
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Jörn Zaefferer
Karl Swedberg schrieb:
> By the way, for others on the list who might not know, :hidden can be  
> used for any element, not just inputs. There is a :visible selector,  
> too.
>   
That is true, but again another ambiguitiy. If you want to select input 
elements of type hidden, :hidden will also select other elements that 
are not visible. In that case, you have to fallback to [EMAIL PROTECTED]

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread frando

Yeah, meant display of course, and tried it with display, and used display,
and I have no idea why the hell I wrote position here ;)



Klaus Hartl-3 wrote:
> 
> frando schrieb:
> 
>> - Changing the css to position: none and then back to position: block
>> - changing the position css attribute to 'table-cell'
> 
> Did you mean the position *property* or did you mean display? The values 
> you are talking of are for the display property, so if you tried what 
> you wrote, that wouldn't have had any effect. Browser ignore 
> declarations with unkown (incorrect) property values.
> 
> 
> Do not confuse them.
> 
> display: inline|block|table-cell|none|...
> 
> position: static|relative|absolute|fixed
> 
> 
> -- Klaus
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Elements-aren%27t-expanding-when-appending-new-children-tf2617104.html#a7304818
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] new jQuery API draft

2006-11-12 Thread Jörn Zaefferer
Yehuda Katz schrieb:
> Great Job! This'll give me some impetus to update Visual jQuery ;)
I still need to add the new option element, I'll take a peek at your 
stylesheet for that :-)

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread Michael Geary
One more comment... As you probably figured out from looking at the
generated source, the culprit is likely to be the animation code, which sets
those unwanted attributes when it animates an item.

So one good test would be to remove all animation and see if it generates
better code.

It will also make the interface more usable. The animation that's there now
doesn't serve any purpose, and it's confusing. The elements shouldn't be
zooming down to a point and then re-expanding. When I move a physical object
it doesn't do that.

Instead, if you want some useful animation, show the element moving from its
old position to its new one, without any unnecessary size changes.

-Mike

In other words, the animation should help show what is actually happening,
> My problem is that, when moving elements right (iow creating 
> a new ul as a child to an existing li), the parent element is 
> not expanding, so the newly created ul is overlapping with 
> other elements.
> 
> Just look at my example page:  http://xcite-online.de/tests/jquery1/
> http://xcite-online.de/tests/jquery1/ .


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Karl Swedberg
On Nov 12, 2006, at 9:33 AM, Jörn Zaefferer wrote:
> I guess the complete documentation for expression needs a good  
> facelift.
> Seems like the input selectors are not documented anywhere.
>
> There is :input, which selects all types of input element (input,
> button, textarea, select).
>
> Then there are a selectors for all types of input elements (:text,
> :file, :hidden, :password etc.)

This is really good to know! I just posted an entry on Learning  
jQuery last night about selector expressions, but I had no idea  
about :text, :file, or :password. I'll have to update the entry today!

By the way, for others on the list who might not know, :hidden can be  
used for any element, not just inputs. There is a :visible selector,  
too.

On Nov 12, 2006, at 10:30 AM, Truppe Steven wrote:
> Also $("#div/form :textarea") does not work and :text only returns all
> type="text" and not the textarea fields.

I'm a little shaky on XPath, but if the CSS equivalent of "#div/form"  
is "#div > form", you could try something like this:

$('#div > form').find('textarea, :text')

That should get any textarea and text input in a form that is a child  
of #div.

>
> Now the only question left is for what this attribute selectors are  
> for
> |= *= ?

Near the bottom of http://jquery.com/docs/Base/Expression/CSS/,  
you'll find the following:

> All attribute selectors are written like their XPath counter-parts  
> (in that all attributes should begin with an @ symbol).
>
> * [EMAIL PROTECTED] an E element with a "foo" attribute
> * [EMAIL PROTECTED] an E element whose "foo" attribute value is  
> exactly equal to "bar"
> * [EMAIL PROTECTED] an E element whose "foo" attribute value begins  
> exactly with the string "bar"
> * [EMAIL PROTECTED] an E element whose "foo" attribute value ends  
> exactly with the string "bar"
> * [EMAIL PROTECTED] an E element whose "foo" attribute value  
> contains the substring "bar"

Hope that helps.

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


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread Michael Geary
> I moved "Testnode" up and then moved it to the right, then 
> used FireBug's Inspect tool to reveal the generated HTML. 
> This is what I saw:

Actually I left out part of it by mistake. Here's the entire UL:




















"node2" is the one I moved up and then to the right.

-Mike


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread Michael Geary
When you have a problem like this, your first thought should be to look at
the generated HTML using Microsoft's DevToolBar in IE or either FireBug or
View Source Chart for Firefox.

I moved "Testnode" up and then moved it to the right, then used FireBug's
Inspect tool to reveal the generated HTML. This is what I saw:

 
 
 
 
 
 
 
 
 ...

Do you see what went wrong? :-)

-Mike

> My problem is that, when moving elements right (iow creating 
> a new ul as a child to an existing li), the parent element is 
> not expanding, so the newly created ul is overlapping with 
> other elements.
> 
> Just look at my example page:  http://xcite-online.de/tests/jquery1/
> http://xcite-online.de/tests/jquery1/ .
> 
> The code is  
> http://snipplr.com/view/1649/jquery-and-uls-on-the-flow/ here 
> , the important part is this:
> $("../..",this).next().append(" class='item'>foo");


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Element tagName

2006-11-12 Thread Michael Geary
> From: Truppe Steven
> 
> my view of the things is a big different. I think jquery 
> should stay as small as possible so adding functions for 
> basic dom attributes is a bit overhead i think ..

I agree. How do you decide which of the many DOM attributes to turn into
jQuery methods? All of them? Especially if they have different names than
the DOM attributes. That is just confusing, unless the idea is that someone
should be able to program only in jQuery and never have to touch the actual
DOM.

If you compare these:

$(foo).tag()

$(foo)[0].tagName

The first looks shorter, but if we make it fair and use the same name:

$(foo).tagName()

$(foo)[0].tagName

Then it's not much of a win.

Hmm... Using the same name makes it confusing. Do I use parens after tagName
or not? But using two different names makes it confusing too. Do I spell it
tag or tagName? Is tag the same as tagName, just a passthrough, or does it
do some actual processing ala .html()?

I just don't see the value here. (No offense to anyone who likes it!)

-Mike


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread Klaus Hartl
frando schrieb:

> - Changing the css to position: none and then back to position: block
> - changing the position css attribute to 'table-cell'

Did you mean the position *property* or did you mean display? The values 
you are talking of are for the display property, so if you tried what 
you wrote, that wouldn't have had any effect. Browser ignore 
declarations with unkown (incorrect) property values.


Do not confuse them.

display: inline|block|table-cell|none|...

position: static|relative|absolute|fixed


-- Klaus


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Elements aren't expanding when appending new children

2006-11-12 Thread frando

I'm currently trying to modify an ul-tree dynamically.

Moving elements up, down and left is working perfectly.

My problem is that, when moving elements right (iow creating a new ul as a
child to an existing li), the parent element is not expanding, so the newly
created ul is overlapping with other elements.

Just look at my example page:  http://xcite-online.de/tests/jquery1/
http://xcite-online.de/tests/jquery1/ .

The code is  http://snipplr.com/view/1649/jquery-and-uls-on-the-flow/ here ,
the important part is this:
$("../..",this).next().append("foo");

Just look on my demo page to see how it looks like.

What I tried so far and what didn't work either:
- Wrapping all the [ul]s in divs
- Replacing all li and ul elements by divs
- Changing the css to position: none and then back to position: block
- changing the position css attribute to 'table-cell'

-- 
View this message in context: 
http://www.nabble.com/Elements-aren%27t-expanding-when-appending-new-children-tf2617104.html#a7303680
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Truppe Steven
Jörn Zaefferer schrieb:
> Then there are a selectors for all types of input elements (:text, 
> :file, :hidden, :password etc.

Thanks for the info, is there a way i can look at the possible selectors
in the jQuery source ?
Also $("#div/form :textarea") does not work and :text only returns all
type="text" and not the textarea fields.

Now the only question left is for what this attribute selectors are for
|= *= ?

I've added an example for :text :hidden :password on
http://jquery.com/docs/Base/Expression/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] new jQuery API draft

2006-11-12 Thread Yehuda Katz
Great Job! This'll give me some impetus to update Visual jQuery ;)-- YehudaOn 11/10/06, Jörn Zaefferer <[EMAIL PROTECTED]
> wrote:Hi jQueryians,I'd like to present you a first draft for a new stylesheet for the
jQuery API: http://joern.jquery.com/api-draft/cat.xmlThere is still lot's of work to do, but the main concern, a new conceptfor the navigation, is already functional. Both Alphabetical and
Category lists will be provided as exapandable trees.Please don't waste your time checking it with IE, the draft works so faronly with Firefox.Please post your opinions and ideas, I'm sure there are many.
RegardsJörn--Jörn Zaeffererhttp://bassistance.de___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/-- Yehuda KatzWeb Developer | Wycats Designs(ph)  718.877.1325
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Jörn Zaefferer

>> While that may work, you should rather use just :text, that is:
>>
>> $("#editarticle/form :text")
>>
>>   
>> 
> Is this in the documentation somewhere ? I haven't seen these special
> selectors like :input :text somewhere mentioned in the docs.
>
> What other selectors are possible beside the :input, :text ?
> What's about thinks like *= += |= for attribute selectors ? Also haven't
> found this in the docs...
>   
I guess the complete documentation for expression needs a good facelift. 
Seems like the input selectors are not documented anywhere.

There is :input, which selects all types of input element (input, 
button, textarea, select).

Then there are a selectors for all types of input elements (:text, 
:file, :hidden, :password etc.)

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Truppe Steven
Jörn Zaefferer schrieb:
> Truppe Steven schrieb:
>   
>> I also have never seen something like: $("#editarticle/form :input")
>> before. Can this be extended like:
>> $("#editarticle/form :[EMAIL PROTECTED]'text']") ?
>>   
>> 
> While that may work, you should rather use just :text, that is:
>
> $("#editarticle/form :text")
>
>   
Is this in the documentation somewhere ? I haven't seen these special
selectors like :input :text somewhere mentioned in the docs.

What other selectors are possible beside the :input, :text ?
What's about thinks like *= += |= for attribute selectors ? Also haven't
found this in the docs...


best regards,
Truppe Steven


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Element tagName

2006-11-12 Thread Truppe Steven
Hello,

my view of the things is a big different. I think jquery should stay as
small as possible so adding functions for basic dom attributes is a bit
overhead i think ..


best regards,
Truppe Steven

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] new jQuery API draft

2006-11-12 Thread Dan Atkinson

Kinda reminds me of the Java API.

Not that that's a bad thing, of course! :)

Good stuff!


Jörn Zaefferer wrote:
> 
> Hi jQueryians,
> 
> I'd like to present you a first draft for a new stylesheet for the 
> jQuery API: http://joern.jquery.com/api-draft/cat.xml
> 
> There is still lot's of work to do, but the main concern, a new concept 
> for the navigation, is already functional. Both Alphabetical and 
> Category lists will be provided as exapandable trees.
> 
> Please don't waste your time checking it with IE, the draft works so far 
> only with Firefox.
> 
> Please post your opinions and ideas, I'm sure there are many.
> 
> Regards
> Jörn
> 
> -- 
> Jörn Zaefferer
> 
> http://bassistance.de
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/new-jQuery-API-draft-tf2610371.html#a7302870
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Jörn Zaefferer
Truppe Steven schrieb:
> I also have never seen something like: $("#editarticle/form :input")
> before. Can this be extended like:
> $("#editarticle/form :[EMAIL PROTECTED]'text']") ?
>   
While that may work, you should rather use just :text, that is:

$("#editarticle/form :text")

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] return this.each

2006-11-12 Thread Oliver Boermans
Michael your explanations are golden!

Despite doing quite a bit work with the magic of JQuery - as a non
JavaScript expert I have been putting off diving into these depths
(such as making a plugin). Just wanted to let you that clear
explanations such as this are immensely valuable and empowering to a
noob like me. Real teach-a-man-to-fish stuff.

I look forward to throwing a line in soon!
Thank-you
Ollie

On 05/11/06, Michael Geary <[EMAIL PROTECTED]> wrote:

> I know that's a lot to chew on (or should I say "this" is a lot to chew
> on!), so feel free to follow up with any other questions...
>
> -Mike

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread Klaus Hartl
David schrieb:
> Mike Alsup schreef:
>> Be careful with :input.  It selects button elements too and resetting
>> the button element's value to "" is probably not what you want to do.
>>   
> To avoid this you could use the button tag.

No, the :input selector selects buttons as well, it is a shortcut for 
*all* kinds of form elements.

-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] if/then equivalents in jQuery

2006-11-12 Thread Christof Donat
Hi,

I don't have much time to help you now, but better formated code 
might help others:

> $.fn.ajaxSubmitEmail = function(e) {
>   this.submit(function(){ 
>   var params = {};
>   $(this).find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'], 
> [EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED], textarea")
>   .filter(":enabled").each(function() { 
>   params[ this.name || this.id || 
> this.parentNode.name || this.parentNode.id ] = this.value;
>   });
>   $("div#indicate").show();
>   $.post(this.getAttribute("action"), params, function(text){
>   $("div#indicate").hide();
>   $('textarea', "emailform").val('');
>   $("div#email").slideUp('fast');
>   
> $("div#thereply").html(text).slideDown('slow').highlightFade({
>   color:'yellow',
>   speed:2000,
>   iterator:'sinusoidal'
>   }); 
>   }); 
>   return false; });
> }  

Christof

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] if/then equivalents in jQuery

2006-11-12 Thread Bruce MacKay


Hi folks,
I'm hoping someone might paint me a picture of how to use jQuery's
equivalent of if/then conditional statements - or how to arrange jQuery
code to allow for such.
I have the following code which collects information from an email form
and sends it to the server for processing.  If the form information
is complete, the email is sent, and the client-side form has the values
of its textarea element set to nothing, and the form itself is made to
disappear.
My problem is that if the form is not sent for some reason (e.g. a valid
address is not given), I don't want the textarea element to be reset or
the form hidden. 
Can someone please give me a conceptual framework/(pseudo-code) example
of how to approach this situation?
Thanks,
Bruce
The code below is how I am achieving the first scenario (when the
information from the email form is all OK and the email is sent after
server-side processing)
$.fn.ajaxSubmitEmail = function(e) {this.submit(function(){ var
params = {}; $(this) .find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'],
[EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED], textarea")
.filter(":enabled") .each(function() { params[ this.name ||
this.id || this.parentNode.name || this.parentNode.id ] = this.value;
});$("div#indicate").show();
$.post(this.getAttribute("action"), params,
function(text){
    $("div#indicate").hide();
    $('textarea', "emailform").val('');
    $("div#email").slideUp('fast'); 
   
$("div#thereply").html(text).slideDown('slow').highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'});
    }); return false; });}

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop through all elements of a form

2006-11-12 Thread David
Mike Alsup schreef:
> Be careful with :input.  It selects button elements too and resetting
> the button element's value to "" is probably not what you want to do.
>   
To avoid this you could use the button tag.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/