jquery appendTo form
Posted
by user313271
on Stack Overflow
See other posts from Stack Overflow
or by user313271
Published on 2010-04-14T08:36:46Z
Indexed on
2010/04/14
8:53 UTC
Read the original article
Hit count: 372
jquery
$(function(){
$('#4').click(function() {
$('<input name="if4" type="text" value="other price>"').appendTo('form');
});
});
html
<form>
< input name="name" type="text" value="Enter your name" /><br />
< input name="contacts" type="text" value="Contact info" /><br />
< select name="services">
< option value="1">1</option>
< option value="2">2</option>
< option value="3">3</option>
< option id="4" value="Other">4</option>
< /select><br />
< textarea name="description">Description</textarea><br />
< /form>
What i want to do:
When i press on option value nr 4, there appears is new input field, this thing works fine.
But how can I to change order where input field gonna appear, because now it appears after textfield, how can i put it after ?
Thank you
© Stack Overflow or respective owner