GithubHelp home page GithubHelp logo

un-chosen an element about chosen HOT 3 OPEN

julesjanssen avatar julesjanssen commented on August 19, 2024
un-chosen an element

from chosen.

Comments (3)

RiZKiT avatar RiZKiT commented on August 19, 2024

Would be interesting for what you will need this, but you can do something like:

$('theSelectId').show().getNext('chzn-container').destroy();

This will show the hidden form field again and destroy the chosen container and the bound events(!), maybe not a perfect solution but a useable.

from chosen.

SandrineProusteau avatar SandrineProusteau commented on August 19, 2024

Hi,
I've done that, to update the chosen on window resize (responsive design with % width) with jQuery:

$('select').chosen();
    $(window).resize(function(){
        $('select').unbind().each(function(){
            $(this).show().removeAttr("id").removeAttr("class");
            if($(this).next('.chzn-container').length>0){
                $(this).next('.chzn-container').remove();
            }
            $(this).chosen();
        });
    });

from chosen.

RiZKiT avatar RiZKiT commented on August 19, 2024

Sandrine, thnx for this, good idea for responsive design. But for update/resize reasons I would suggest a faster solution instead of rebuilding choosen again, especially if there are alot of chosen elements or alot of entries in the dropdowns.

I looked at the code and there are three width values which have to be recalculated on update: 'this.f_width' for the container, 'dd_width' for the dropdown and 'sf_width' for the search field. All can be found in 'set_up_html()', put these things in an update() function and it should be done.

from chosen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.