admin管理员组文章数量:1414924
I have na excel sheet with the data:
English | Spanish | Italian | French
I'd like to be able to copy all these inputs and paste it to the form:
<input type="text" name="english">
<input type="text" name="spanish">
<input type="text" name="italian">
<input type="text" name="french">
so far when I copy all the data it will all paste into first input field. I'm asking this before I start coding as I'm not sure if it's even possible to do.
Any directions appreciated!
I have na excel sheet with the data:
English | Spanish | Italian | French
I'd like to be able to copy all these inputs and paste it to the form:
<input type="text" name="english">
<input type="text" name="spanish">
<input type="text" name="italian">
<input type="text" name="french">
so far when I copy all the data it will all paste into first input field. I'm asking this before I start coding as I'm not sure if it's even possible to do.
Any directions appreciated!
Share Improve this question asked Jun 13, 2014 at 15:28 GrasperGrasper 1,31312 silver badges27 bronze badges2 Answers
Reset to default 3Upon your clarification, you can use jQuery to capture the paste action into anyone of those fields. Then simply parse and send it to the right input box.
HTML
<input type="text" name="english">
<input type="text" name="spanish">
<input type="text" name="italian">
<input type="text" name="french">
jQuery
$('input').bind('paste', null, function(e){
$this = $(this);
setTimeout(function(){
var columns = $this.val().split(/\s+/);
$this.val(' ');
var i;
for(i=0; i < columns.length; i++){
var name = columns[i].toLowerCase();
$('input[name="' + name + '"]').val(columns[i]);
}
}, 0);
});
Here's a demo fiddle to look at : http://jsfiddle/adjit/3N94L/3/
The clipboard is not going to allow this. You might want to look into a library like HandsOnTable which will parse the clipboard/excel data and run the paste into multiple inputs.
http://handsontable./
本文标签: javascriptjQuery copy from Excel to multiple input fieldsStack Overflow
版权声明:本文标题:javascript - jQuery copy from Excel to multiple input fields - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745170343a2645936.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论