Changing globally manipulated variable being passed through onclick function

26 Views Asked by At

I am having trouble changing a JSON object when using an onclick function on a table row in my .pug file. My function is located in a .js file.

<th onclick="changeQuality(#{JSON.stringify(testData)}, 'Good')" class= "col-fixed-img"><img src="/images/Check.jpg"></th>

my function changeQuality() located in my .js file:

 function changeQuality(testData, id) {
  testData.newQuality = id;
}

The value is getting set properly within my changeQuality function in my .js file, however it doesn't change the value of testData in my .pug file. How can I make it so that when this function is called it will update immediately the data found in my .pug file?

0

There are 0 best solutions below