Let say I have this variable html which contain these select options:
var html = '<select>'+ '<option value="10">10</option>'+ '<option value="20">20</option>'+ '</select>'; How can I programmatically select an option which is inside the html variable so when I append them to somewhere, for example
$('#select_handle'this).children('div').append(html); it will become like this:
<div<div> id="select_handle"><!-- children div of the current scope --> <select> <option value="10" selected>10</option> <option value="20">20</option> </select> </div> How is it possible?
edit: the variable contents is generated from remote locations, and I must change the value locally before it is being appended into a div. Hence, the question.
edit 2: sorry for the confusion, question has been updated with my real situation.