我想用新值替換名稱屬性的一部分。該值取決於原始值。 name屬性的數值爲:時隙[timeslot_1] [開始]替換jQuery中表單元素屬性的一部分
如何增加價值「timeslot_1」到「timeslot_2」,並與這一個替換原來的價值?
cloneElm由兩種類型的元素(輸入和選擇)組成 - 我希望能夠捕獲我的循環中的兩個元素。
的代碼,我到目前爲止有:
$(cloneElm).children('span').children('input').each(function(id) {
var newName = $(this).attr('name').replace('timeslot_1', 'timeslot_2');
$(this).attr('name', newName);
});
感謝