jQuery ships with Drupal. Use class-based selectors http://api.jquery.com/category/selectors/
alert($(".pane-uc-cart-0").html()); 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. On Fri, Jan 28, 2011 at 9:34 AM, John Mitchell <mitchellj...@gmail.com>wrote: > 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'); > ). > > <div class="panel-pane pane-block pane-uc-cart-0"> > > How can I refer to the shopping cart using document.getElementById if it > does not have an id? > > -- > John J. Mitchell >