onclick help - reading the value of a specific class
<p>I hope my description will not be too confusing! I am trying to integrate a javascript shopping cart, simplecart-js, into a Jquery LightBox, Yoxview. Yoxview has an option to add button links in the popup title pane for various options, downloading, shopping cart, etc. The relevant code for the shopping cart button is:</p>

<pre><code>var yoxviewCartButton = $("&lt;a&gt;", {
    title: "Add to cart",
            href: "javascript:;",
    onclick:"simpleCart.add('name=Awesome', 'price=14.95','quantity=1');"
        });
        yoxviewCartButton.append($("&lt;img&gt;", {
            src: "yoxview/images/yoxview_cart_icon.png",
            alt: "Add to cart",
            css: { width: 18, height: 18 },

        }));
</code></pre>

<p>the specific integration for shopingcart-js into the button is:</p>

<pre><code>href: "javascript:;",
onclick:"simpleCart.add('name=Awesome', 'price=14.95','quantity=1');
</code></pre>

<p>the html structure I'm using is:</p>

<pre><code>&lt;a class="item yoxview simpleCart_shelfItem" href="pics/pic0.png" title="Test1"&gt;
&lt;img class="content" src="pics/pic0.png" title="Test1"/&gt;
&lt;span class="caption item_name"&gt;Pic 0 
&lt;span class="item_price"&gt;$14.99&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;
</code></pre>

<p>The onclick event works but inputs the same info for each image, obviously, so I am trying to get the "item_name" and "item_price" for each "simpleCart_shelfItem" to input into the name= and price= field of the onclick event. I'm not sure how to get jquery to input these values. Any help or direction would be greatly appreciated. </p>

<p>BTW, Before I tried butchering this code, the original code was set to show an alert:</p>

<pre><code> var yoxviewCartButton = $("&lt;a&gt;", {
            title: "Add to cart",
            href: "#",
            click: function(e){
                e.preventDefault();
                alert("The image \"" + $(this).data("yoxview_cart") + "\" can be added to cart through AJAX.");
            }
        });
        yoxviewCartButton.append($("&lt;img&gt;", {
            src: "../images/yoxview_cart_icon.png",
            alt: "Add to cart",
            css: { width: 18, height: 18 }
        }));

        $(".yoxview").yoxview({ 
            infoButtons: {
                download: yoxviewDownloadButton,
                cart: yoxviewCartButton
            },
            onSelect: function(i, image)
            {
                $.yoxview.infoButtons.download.attr("href", image.media.src);
                $.yoxview.infoButtons.cart.data("yoxview_cart", image.media.src);
            }
        });
    });
</code></pre>
