0
在某些插件下面的代码运行时一个单选按钮手动检查:触发jQuery代码别处
;(function ($, window, document, undefined) {
$.fn.wc_variation_form = function() {
var $form = this;
$form.on('change', '.variations input:radio', function() {
// this code runs when radio buttons are checked
});
});
在我自己的jQuery代码,我需要使用prop('checked', true)
检查相同的单选按钮。问题:这样做不能触发上面的代码。我怎样才能确保它被执行?
谢谢,虽然似乎不工作。我做了:$('.variations_fieldset input [value =“Every 3 months”]').prop('checked',true).change(); – drake035
在此处正常工作https://jsfiddle.net/o4moed15/ – charlietfl
是的,谢谢@charlietfl!我不明白为什么它不适合我的代码.. – drake035