jquery - Appending text to input field on submit -
i have form looks this:
<form> <input type="text" value="" name="order[]" title="salmon" /> <input type="text" value="" name="order[]" title="trout" /> <input type="text" value="" name="order[]" title="halibut" /> <input type="text" value="" name="order[]" title="crab" /> <button type="submit">submit</button> </form>
users inputting number value. when submit form want append title of each input submission. if user input "5" first input field, submit value "salmon - 5".
how achieve jquery?
i have working here http://jsfiddle.net/nlts9/6/. change type="submit" type="button"
$('button').click(function () { $('input[name="order[]"]').map(function () { $(this).val($(this).attr('title') + ' - ' + $(this).val()); alert($(this).val()); }); });
Comments
Post a Comment