jquery on change at span id want to insert whole select box -
here example http://jsfiddle.net/4yp9k81w/9/
here html
<span id="span_upper_level_name"> <select name="upper_level_id0" id="upper_level_id0" class="upper_level_id" > <option value="select1">select1</option> <option value="2">transport</option> </select> <select name="upper_level_id1" id="upper_level_id1" class="upper_level_id" > <option value="select2">select2</option> <option value="4">cars</option> </select> </span> <span id="span_position_after">position after</span>
here jquery
$('.upper_level_id').change(function(){ $('#span_position_after').html( $( '#upper_level_id0' ).html() ); });
if select box changes, want insert select box in span_position_after
.
but can insert words/options of select box (can not insert drop down box).
how insert drop down box in #span_position_after
?
just insert outerhtml
or clone it.
$(document).ready(function () { $('.upper_level_id').change(function () { $('#span_position_after').html($('#upper_level_id0')[0].outerhtml); }); });
Comments
Post a Comment