javascript - Jquery - Break up values into individual input fields -
the following app copy's excel values , breaks them individual input fields.
everything works great i'm loosing first value.
for example, if create 5 entries. first input field's id 001, second 002 etc etc.
when copy , paste excel column, value 002 gets copied 001 id.
here's data i'm copying excel
1 2 3 4 5
https://jsfiddle.net/jdarville/r9tp7762/1/
$( document ).ready(function() { $("#uncinfo").bind("paste", function(e){ // access clipboard using api var pasteddata = e.originalevent.clipboarddata.getdata('text'); arr = pasteddata.split(/\s+/); for(i=1; < arr.length; i++){ $("#unc"+i).val(arr[i]); } } ); });
$("#uncinfo").bind("paste", function(e){ // access clipboard using api var pasteddata = e.originalevent.clipboarddata.getdata('text'); arr = pasteddata.split(/\s+/); for(i=1; <= arr.length; i++){ $("#unc"+i).val(arr[i -1]); } });
check this
Comments
Post a Comment