I tried all 3 of the previous email suggestions in order get access to DOM objects within my .js file:<br><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup {  position:absolute;  z-index:9999;  padding: 0px 0px;  margin-left: 0px;  margin-top: 0px;  width: 240px;  overflow: hidden;  word-wrap: break-word;  color: black;  font-size: 10px;  text-align: left;  line-height: 13px;}</style><br>
a.) Drupal behaviors:  i.e. Drupal.behaviors.foo = function() {alert($(&quot;.pane-uc-cart-0&quot;).html());};                <br>b.) $(document).ready: i.e. $(document).ready(function(){alert($(&quot;.pane-uc-cart-0&quot;).html());});                <br>

c.) By adding the .js file to the footer instead of the default of header: i.e. drupal_add_js(drupal_get_path(&#39;module&#39;, &#39;product_type&#39;) . &#39;/js/shopping_cart_info.js&#39;, &#39;module&#39;, &#39;footer&#39;);<br>

and then calling the alert statement within the .js file like was already done within the &quot;A&quot; and &quot;B&quot; examples: i.e. alert($(&quot;.pane-uc-cart-0&quot;).html());<br><br>After clicking the &quot;add to cart&quot; link (i.e. <a href="https://mydomain/cart/add/p110_a2o09-24-100-001">https://mydomain/cart/add/p110_a2o09-24-100-001</a>) then hook_cart_item is executed which includes the .js file which is executed which does a number of things including calling the alert statement.<br>

For all three of the above the alert statement was not even executed.  If I just added the .js file to the header like I had done previously then the alert statement executes but it returns null.  <br>In looking at firebug within firefox I noticed that both <a href="https://mydomain/cart/add/p110_a2o09-24-100-001">https://mydomain/cart/add/p110_a2o09-24-100-001</a> and <a href="https://mydomain/cart">https://mydomain/cart</a> requests completed but all the other ones after that did not complete (i.e. <a href="https://mydomain/modules/node/node.css?x">https://mydomain/modules/node/node.css?x</a>).  So I guess because these other requests never completed which means that the rest of the DOM never loaded.  So if the .js file is at the footer or waiting for the DOM to complete the alert statement would not execute.<br>
<br>Is their any way that I can get these requests to complete?<br><br>Thanks,<br><br>John <br><br><br><div style="display: inline;">
</div><br>
<div class="gmail_quote">On Fri, Jan 28, 2011 at 12:15 PM, Carl Wiedemann <span dir="ltr">&lt;<a href="mailto:carl.wiedemann@gmail.com" target="_blank">carl.wiedemann@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

jQuery ships with Drupal. Use class-based selectors <a href="http://api.jquery.com/category/selectors/" target="_blank">http://api.jquery.com/category/selectors/</a><div><br>alert($(&quot;.pane-uc-cart-0&quot;).html());</div>

<div><br></div>
<div>However, if you are adding JS &#39;inline&#39; it is added to the &lt;head&gt; which executes before the rest of the DOM is loaded and so you won&#39;t get any response. Use $(document).ready(function(){ ... }); or Drupal.behaviors.foo = function() { ... } instead, or simply add it to the footer.<div>

<div></div><div><br>
<div><br><div class="gmail_quote">On Fri, Jan 28, 2011 at 9:34 AM, John Mitchell <span dir="ltr">&lt;<a href="mailto:mitchelljj98@gmail.com" target="_blank">mitchelljj98@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


I am trying to get the id for the drupal shopping cart widget so that I can refer to it within javascript.  When I look at the shopping cart div within firebug (see below) it only lists the class and not the id and I tried referring to the class like it was the id but it was not recognized (i.e. drupal_add_js(&#39;alert(document.getElementById(&quot;panel-pane pane-block pane-uc-cart-0&quot;).value)&#39;,&#39;inline&#39;);<br>



).<br><br>&lt;div class=&quot;panel-pane pane-block pane-uc-cart-0&quot;&gt;<br><br>How can I refer to the shopping cart using document.getElementById if it does not have an id?<br><font color="#888888"><div style="display: inline;">



</div><br>
-- <br>John J. Mitchell<br>
</font></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>John J. Mitchell<br>