获取表单字段的值

Get Value of Form Field

本文关键字:字段 表单 获取      更新时间:2023-09-26

我在我的页面上动态创建了几个字段。为了将该行的ID字段与该行正确的"ntheme"字段对齐,我使用了以下函数。

$(document).on('change', 'select', function() {
  var checkbox = $(this),
    otherInput = $('nrowid' + this.id.replace('ntheme', ''));
    console.log(otherInput);
   console.log($(this).val());
 for(var i=0;i<rows1;i++){
  if($(this).val()==themes[i].Themes){
//set value of otherinput to themes[i].ID
  }
 }
  console.log(otherInput.val());
});

是否有一种方法可以设置otherInput字段的值,然后使用console.log返回该值?

//获取var otherInput2 = $('# nrowwid ').val();

//集var otherInput2 = $('#狭窄')。瓦尔("价值");

console.log (otherInput2);