アラート ボックスが表示されるのはなぜですか
$(function() {
$('#users').each(function() {
var select = $(this);
var option = select.children('option').first();
select.after(option.text());
select.hide();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="users" name="users">
<option value="bad"><script>alert('xss');</script></option>
</select>
オプションテキストにエンコードされたバージョン(<script>alert('xss');</script>)
がありますが??
オプション テキストに html をエンコードしたため、アラートが表示されないようにしています。