lundi 20 avril 2015

How can i reset a selectpicker after hide a modal?

(sorry my english)

Hey , well i have a select picker:

                    +                       
                    '<select class="selectpicker" id="select_seleccionar_proyecto_id">'
                    +
                    '<option value="0">Seleccione..</option>'
                    +                           
                    '<option value="1">Tarea número 1</option>'
                    +                           
                    '<option value="2">Tarea número 2</option>'
                    +                       
                    '<option value="3">Tarea número 3</option>'
                    +
                    '<option value="4">Tarea número 4</option>'
                    +                           
                    '<option value="5">Tarea número 5</option>'
                    +                       
                    '<option value="6">Tarea número 6</option>' 
                    +                   
                    '</select>'         

this select box is in a modal, and when i close this modal, the select box is like the last time , example: i select "tarea numero 4", i close the modal and open the modal and "tarea numero 4" is selected. Well, i have a method that i call after hide the modal and when i open i need "seleccionar..", but nothing work..

¿what is the best option in jquery? thanks

HideModal: function(){
    var self = this;
    $('#modal_seleccionar_tarea_id').modal('hide');
    self.LimpiarModalTarea();
    },

LimpiarModalTarea: function(){
var self = this;

 $('#select_seleccionar_proyecto_id').val("0");},

PD : this work in other modal, but with textarea.

Aucun commentaire:

Enregistrer un commentaire