DEV Community


You can write better jQuery

Nick Ciolpan
I have extensive experience as a full stack developer, managing clients and building state of the art platforms.
・1 min read

While almost every new article mentioning it, talks about its demise, I’ve decided to write as about one of the most recurrent jQuery bad practices I came across and how to deal with it. Here it is:

Going from this:

    buttonClass: 'btn btn-default',
    buttonWidth: '100%',
    buttonClass: 'btn btn-default',
    buttonWidth: '100%',
    nonSelectedText: '---',

To This:

<select class="js-multiselect" 

$('.js-multi-select).each(function () {
    let options = {};

        .map(property => options[property[0]] = property[1]);



And never go back for adjustments in the script file ever again.

Discussion (0)