<select id="things">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
$('#things').after($('#things').clone());
How could I insert a break between these two elements while cloning? Is there a neat way to do it in one line of code? I have tried:
$('#things').after('<br/>' + $('#things').clone()); //returns [object object]
http://jsfiddle.net/ydAdS/
You're trying to add a string, and an object. Create a jQuery object for the <br/> instead:
$("#things").after( $("<br>").add( $("#things").clone() ) );
Fiddle: http://jsfiddle.net/As2Se/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With