Hey Bartee,

I think your problem is that .length() returns the number of elements in the
object you're acting on. In you're case, there's only one object (a text
node). So, it should return one. What you're actually looking for is
$("div#div2").text().length;

On Mon, Jan 19, 2009 at 12:25 PM, bartee <bar...@gmail.com> wrote:

>
> My alert always returns "1" as the divcount value ???
>
> What's up with that.. I have read and tried bunches of things.
>
> What am I missing ????
>
>
> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en-AU">
> <head>
>  <title>Jquery Test</title>
>  <script type="text/javascript" src="jquery-1.3.js"></script>
>  <script type="text/javascript">
>    $(function() {
>      var divcount = $("div#div2").length;
>      alert("start=" + divcount);
>    });
>  </script>
> </head>
> <body>
>  <div id="div2">asdf</div>
>  <div id="div2">asdf</div>
>  <div id="div2">asdf</div>
> </body>
> </html>
>

Reply via email to