When firing a click event on a label $('#someOption label').click();
, the page automatically scrolls to the related checkbox (if it is off the viewport), how can i prevent that?
I would try setting the scroll position using jQuery, but my page consists of dynamic elements which means the height of the page is never the same.
I think the problem is because you are clicking the label; can you click the checkbox element instead, like:
$('#someOption input').click();
除了调用标签的单击之外,为什么不选择复选框呢?
$('#someCheckbox').prop('checked', true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.