Question

JS:

$(document).ready(function () {
    $('#demo2').click(function () {
        $.blockUI({
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
        });

        setTimeout($.unblockUI, 2000);
    });
}); 

I have searched on how to block the UI whenever the data is being processed, i want to block the UI, however, the code that I saw was on button click, I want to execute the block UI on selected index change..

Was it helpful?

Solution

You want .change instead of .click. Assuming the select has the id: 'demo2':

$(document).ready(function () {
    $('#demo2').change(function () {
        $.blockUI({
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
        });

        setTimeout($.unblockUI, 2000);
    });
}); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top