Reputation: 6695
I have the following form on my website
input a
input b
input c
Is it possible to have the following done using jQuery?
input a
input c
input b
Keep in mind that the form still needs to collect the data correctly.
Please advise.
Upvotes: 0
Views: 8208
Reputation: 253318
Yes, that's possible, it's easier, albeit the same technique, with id
s but if you just know which one you want to move, then:
$('input:text:nth-child(3)').insertAfter($('input:text:nth-child(1)'));
JS Fiddle of id
-based approach (generously offered by Vega).
Or, similarly:
$('input:text:nth-child(3)').appendTo($('input:text:nth-child(1)').parent());
JS Fiddle demo of id
-based approach.
References:
Upvotes: 5