Try moving the script to a global function called
pageLoad
:
<script>
function pageLoad(){
$(".js-example-placeholder-single").select2({
placeholder: "Select a state",
allowClear: true
});
}
</script>
That will work if you only need a single startup script per page. If you need more than one, then try:
<script>
$(function(){
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function(){
$(".js-example-placeholder-single").select2({
placeholder: "Select a state",
allowClear: true
});
});
});
</script>