関数に渡されたテキスト値を持つドロップダウン リストでオプションを選択し、その値を取得して、その値を持つオプションを選択しようとしています。これが機能しない理由がわかりますか?
function selectAndAddToCart(value)
{
console.log('The selectAndAddToCart onclick value is ' + value);
var optionToSelect = $j('#attribute136').find('option[text="' + value + '"]').val(); //select the option with the node text that equals value
//select the option with the node text that equals value
var vals = $j('#attribute136').val() || [];
vals.push(optionToSelect);
$j('#attribute136').val(vals);
//initiate add to cart function
productAddToCartForm.submit(this);
}