我與他們每個人的和復位按鈕,單擊窗體選項卡,它重置只是形式的表單字段。優化復位形式不同形式的領域的jQuery
//Reset respective forms
$('#thresholds .reset').on('click', function() {
$('#thresholds').trigger("reset");
});
$('#attributes .reset').on('click', function() {
$('#attributes').trigger("reset");
});
$('#rules .reset').on('click', function() {
$('#rules').trigger("reset");
});
$('#events .reset').on('click', function() {
$('#events').trigger("reset");
});
#thresholds,#attributes,#rules,#events是表單ID。
我如何優化此代碼重複?
This Works!謝謝:d –
不客氣,如果是幫你,請[給予好評,並接受答案】(https://stackoverflow.com/help/someone-answers)編碼快樂! :) –
已經有:) –