At the moment, I am utilizing jQuery ajax to dynamically add content to my website. Additionally, I have incorporated the jquery.selectbox-0.6.1.js plugin to enhance the style of select boxes on the page.
The plugin successfully styles the select boxes upon the initial load of the page. However, when I trigger an ajax response to update specific content on the page, the selectbox plugin fails to apply the CSS styling to the replaced select box from the ajax call.
Below is a snippet of my code:
$.ajax({
url: '/find-job?filter=1',
type:'GET',
async:false,
success: function (data) {
var $response = $(data);
$response.find('.view').each(function(){
$('.view').replaceWith(this).html;
});
}
});
Although everything functions correctly, the selectbox plugin does not style the updated select box after the ajax call.
I am puzzled as to why the plugin is not automatically applying the CSS. Any insights on this issue?