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
Post a Comment