JSFiddle - React, Tailwind, and code Playground

by joycse06

HTML

<link rel="stylesheet" href="http://www.bulgaria-web-developers.com/projects/javascript/selectbox/css/jquery.selectbox.css">
<script src="http://www.bulgaria-web-developers.com/projects/javascript/selectbox/js/jquery.selectbox.js"></script>
<button id='refresh'>Refresh</button>

<div id="page">
 <div id="ajax_container">
 <select><option>Test 1</option><option>Test 2</option><option>Test 3</option><option>Test 4</option><option>Test 5</option><option>Test 6</option><option>Test 7</option><option>Test 8</option><option>Test 9</option></select>
 </div>
</div>

JavaScript

$(function(){
    
    $('#ajax_container select').selectbox({
                   effect: "fade"
                });
    $('#refresh').on('click',function(){
       
        var html = "<select><option>Ajax Test 1</option><option>Ajax Test 2</option><option>Ajax Test 3</option><option>Ajax Test 4</option><option>Ajax Test 5</option><option>Ajax Test 6</option><option>Ajax Test 7</option><option>Ajax Test 8</option><option>Ajax Test 9</option></select>";
        
        $('#ajax_container').html('');
        
        $.post('/echo/html/',{html:html,delay:3},function(data){
           console.log(data);
                $(data).appendTo('#ajax_container').filter('select').selectbox({
                   effect: "fade"
                });
        });
        
        
        
    });
});