Get content of a div
- by Sergiu
<select>
<div class="options">
<option value="nothing">Nothing</option>
<option value="snothing">Second Nothing</option>
</div>
</select>
I want to get the content of the DIV and print it inside javascript in a selector.
$(document).ready(function () {
var options = $('.options').html();
.
.
.
var content = '<select>' + options + '</select>';
.
.
.
});
I need to take options from the HTML. I've created a div indise <select></select> tags, because I had no other idea. But it's not working!
I tried to put the options var inside <p></p> tags so i can print it, it sais 'undefined'.