harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.85k stars 4.1k forks source link

chosen plugin not working in codeigniter #2577

Closed mzohaibniaz closed 8 years ago

mzohaibniaz commented 8 years ago

This is placed in head

<?php echo link_tag('assets/choosen/chosen.css'); ?>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>

<script src="<?php echo base_url();?>assets/choosen/chosen.jquery.js" type="text/javascript" >  </script>

<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>

    <script src="<?php echo base_url(); ?>assets/choosen/chosen.proto.js" type="text/javascript"></script>

and body is

                    <select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
                        <option value=""></option>
                        <option value="United States">United States</option>
                        <option value="Faroe Islands">Faroe Islands</option>
                        <option value="Yemen">Yemen</option>
                        <option value="Zambia">Zambia</option>
                        <option value="Zimbabwe">Zimbabwe</option>
                    </select>

                    <br><br><br><br><br>

    <script type="text/javascript">
        document.observe('dom:loaded', function(evt) {
            var config = {
                '.chosen-select'           : {},
                '.chosen-select-deselect'  : {allow_single_deselect:true},
                '.chosen-select-no-single' : {disable_search_threshold:10},
                '.chosen-select-no-results': {no_results_text: "Oops, nothing found!"},
                '.chosen-select-width'     : {width: "95%"}
            }
            var results = [];
            for (var selector in config) {
                var elements = $$(selector);
                for (var i = 0; i < elements.length; i++) {
                    results.push(new Chosen(elements[i],config[selector]));
                }
            }
            return results;
        });
    </script>

Please help me, I don't know problem

tjschuck commented 8 years ago

The GitHub issue tracker is intended for bug reports, specific feature requests, and submitting pull requests.

For support issues or usage questions (like this one) that are not bugs in Chosen itself, please post somewhere like StackOverflow, using the jquery-chosen tag. You'll be more likely to get a quick answer there.