javascript - Explode textbox comma seperated into individual textbox's -


hi i'm trying explode text box 5 individual text box's.

current result

<input name="textfield" type="text" id="textfield" value="2, simon feld,     1968, tas" size="40"> 

desired result

<input name="textfield" type="text" id="textfield" value="2" size="40"> <input name="textfield" type="text" id="textfield" value="simon feld" size="40"> <input name="textfield" type="text" id="textfield" value="1968" size="40"> 

below can find working example , fiddle

function makeseperateinputs() { var arrofvalues = $('#textfield').val().split(','); for(var i=0, len = arrofvalues.length; < len; i++) { $('body').append('<input name="textfield" type="text" id="textfield' + + '" value="' + arrofvalues[i] + '" size="40"><br>') } } $('body').on('click', '#seperatethem', function() { makeseperateinputs() }) 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -