I notice you are running an "each" method when the "find" is looking for an id ("#invoice"). This implies that you are looping over multiple elements with the same id. This will mess things up as it is invalid to have multiple elements with the same id. Try using "invoice" as a class rather than an id in your html.

<li class="invoice">invalid</li>

-- Josh


----- Original Message ----- From: "John Resig" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Thursday, August 30, 2007 9:36 AM
Subject: [jQuery] Re: $(html) error...I think. Please help, I'm stumped!



What version of jQuery are you using?

--John

On 8/30/07, Dustin Martin <[EMAIL PROTECTED]> wrote:

Hello everyone! My name is Dustin and was hoping I could get a little
help with a JQuery problem  I've run into. I just started using JQuery
and have been trying out a little AJAX when I ran into a problem. In
Firefox (using Firebug) I get the error:

ret[i].getElementsByTagName is not a function
r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));

Here is my Javascript code where the error appears to be.

                $.ajax({
                    url: 'CS_AJAX_Server_Responder.cfm',
                    type: 'POST',
                    dataType: 'html',
                    timeout: 30000,
                    data:
{Invoice:invoiceNum,Store:storeNum,Div:divNum,invoicevalidate:'true' },
                    error: function(){
                        $('#loadingimg').fadeOut("slow");
alert('Error accessing server. Please try again.');
                    },
                        success: function(html){
                                $('#loadingimg').fadeOut("slow");
                                alert('test message');

                            $(html).find('#invoice').each(function(){
                                var invalidDiv = $(this).text();
                                        alert(invalidDiv);
                            });
                        }
                });
        }
}

My server side code is very simple.

<ul><li id="invoice">invalid</li></ul>

The error appears to be caused by $(html).find() but I really do not
have a clue as to why.  Once I remove the  $(html).find() code it no
longer throws the error. The frustrating thing is that I had
everything working yesterday but it does not work any longer and I
have no idea what I changed that could have led to this error. In IE I
don't get any error but it doesn't proceed through the code like
normal. Please, any insight and help would be appreciated...this has
been driving me up the wall.



Reply via email to