Jess McKenzie Jess McKenzie - 1 year ago 50
Javascript Question

Percentage of values changed in a textarea


is a textarea

is also a textarea but this is were I will be making the changes

How could I calculate a percentage of the values changed in B starting at 0%?


var changed, original = $(".originalData").val() $(".changedData").change(function(){ changed = $(this).val(); });

Answer Source

if you want to calculate the percent of changes i guess you have to do something like this

var changedData = $('.changedData').val().length;
var originalData = $('.changedData').val().length;

var precentageOfChange = changedData/originalData * 100 - 100