Get content of a div

Posted by Sergiu on Stack Overflow See other posts from Stack Overflow or by Sergiu
Published on 2013-06-29T21:41:16Z Indexed on 2013/06/29 22:21 UTC
Read the original article Hit count: 153

Filed under:
|
|
|
|
<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'.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery