jQuery ships with Drupal. Use class-based selectors <a href="http://api.jquery.com/category/selectors/">http://api.jquery.com/category/selectors/</a><div><br>alert($(".pane-uc-cart-0").html());</div><div><br></div>
<div>However, if you are adding JS 'inline' it is added to the <head> which executes before the rest of the DOM is loaded and so you won't get any response. Use $(document).ready(function(){ ... }); or Drupal.behaviors.foo = function() { ... } instead, or simply add it to the footer.<br>
<div><br><div class="gmail_quote">On Fri, Jan 28, 2011 at 9:34 AM, John Mitchell <span dir="ltr"><<a href="mailto:mitchelljj98@gmail.com">mitchelljj98@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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('alert(document.getElementById("panel-pane pane-block pane-uc-cart-0").value)','inline');<br>
).<br><br><div class="panel-pane pane-block pane-uc-cart-0"><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>