well, you can't have 3 id's all called div2
id's have to be unique, you can have multiple classes.

I've not used the length function, but I'm fairly certain it has to do with the multiple id's.

bartee 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