http://m.nike.com/us/en_us/pd/kobe-ix-shoe/pid-973344/pgid-973347
对于本网站,我在尝试完成加载后点击添加到购物车按钮。这会有用吗?如果没有,为什么?
$(document).ready(function () {
$('add-to-cart-btn').load(function () {
var size_i_want = '%@';
var how_many = % i;
var sizesList = document.getElementById('frm-size-select');
for (var i = 0; i < sizesList.length; i++) {
if (sizesList.options[i].text == size_i_want) {
sizesList.selectedIndex = i;
document.getElementById('quantity-dd').selectedIndex = how_many - 1;
}
}
document.getElementById('add-to-cart-btn').click();
});
P.S。对不起,我在js和jq非常棒的
答案 0 :(得分:0)
因为你正在使用jquery,你可以这样做:
$('#add-to-cart-btn').trigger('click');