jquery selector array -
I have been added to the basket problem. Some products have options such as color / size to draw an input for selection box and volume for color / size
& lt; Select Name = "Product Options [1234] [Color]" & gt; & Lt; Select Name = "Product Option [1234] [Size]" & gt; & Lt; Input type = "text" name = "product option [1234] [qty]" & gt;
Then the option is a product that holds values for each product. In Abov example, there are product options with ID = 1234.
I tried
var productOptions = $ ("name = = 'productOption [" + productID + "]'"). well ();
Expected to get an array of the option of the given product ID, but it is not working. Options can dynamically have additional options for some products
< P> Can someone help me with the selector so that they can retrieve the values array for the given product ID and send them to the server side.Thanks
I think you think that you use jQuery are doing.
& lt; Script type = "text / javascript" & gt; Function getProductDetails (product_id) {var product_details = []; Jquery ('[name * =' productOption ['+ product_id +'] "] ') .ech (function () {var option = jQuery (this); var type = option.attr (' name ') .mail (/ ProductOption \ [\ d + \] \ [[\ w +) \] / product_details [type [1]] = option.val ();}); return product_details;} & lt; / script & gt; < / Code>
This will return an associated array. You can ...
var Description = getProductDetails (1234); Alert (description [quantity] ]);
Comments
Post a Comment