jquery appendTo表单

use*_*271 0 jquery appendto

jQuery的

$(function(){
 $('#4').click(function() {
 $('<input name="if4" type="text" value="other price>"').appendTo('form');
   });
 });
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

我想做的事:

当我按下选项值nr 4时,会出现新的输入字段,这个工作正常.

但是我怎么能改变输入字段出现的顺序,因为现在它出现在textfield之后,我怎么能把它放在后呢?

谢谢

Sim*_*eon 6

// Inserts last in any <form>
$('<p>Test</p>').appendTo('form');

// Inserts first in any <form>
$('<p>Test</p>').prependTo('form');

// Inserts right before any <textarea> in any <form>
$('<p>Test</p>').insertBefore('form textarea');

// Inserts right after any <textarea> in any <form>
$('<p>Test</p>').insertAfter('form textarea');
Run Code Online (Sandbox Code Playgroud)