0

I have several fields dynamically created on my page. I use the following function in order to align the ID field of that row with the correct "ntheme" field of that row.

$(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());
});

Is there a way I can set the value of the otherInput field and then return that value using console.log?

Jordan Davis
  • 855
  • 3
  • 15
  • 22

1 Answers1

0

//Get var otherInput2 = $('#nrowid').val();

//Set var otherInput2 = $('#nrowid').val('your value');

console.log(otherInput2);

Yuri Pereira
  • 1,945
  • 17
  • 24