reset Datepicker and select multiple with JQuery

0

I need to reset two Datepicker and select multiple Bootstrap when I finish doing some processes on the form, but I have not succeeded, how can I do that?

My HTML code is this:

<%--/*fecha inicial*/--%>
        <div class=" col-sm-3 col-md-3 col-lg-3 col-xs-3"> 
            <label for="comment">Fecha Inicial:</label>
            <div class="input-group date">   
                <input class="form-control SoloNumeros" id="txtFechaI" onkeypress="setSoloNumeros()" placeholder="Seleccine una fecha"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div> 
        </div>
     <%--/*----------*/--%>
     <%--/*fecha final */--%>
        <div class=" col-sm-3 col-md-3 col-lg-3 col-xs-3">   
             <label for="comment">Fecha Final:</label>
            <div class="input-group date">   
                <input class="form-control SoloNumeros" id="txtFechaF" onkeypress="setSoloNumeros()" placeholder="Seleccine una fecha"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div> 
        </div>
     <%--/*----------*/--%>

 <%--/*analisis*/--%>  
        <div class=" col-sm-5 col-md-5 col-lg-5 col-xs-5"> 
           <label for="comment">Analisis:</label> 
            <div class="input-group">   
                <span class="input-group-addon"><i class="glyphicon glyphicon-list-alt"></i></span>
                <select  class="form-control" multiple="multiple" id="selAnalisis">                   
                    <option disabled="" selected="">--Seleccione Un Tipo de Analisis Primero--</option>                   
                </select>
            </div>
        </div>
        <%--/*----------*/--%>

How can I do it with JQuery?

    
asked by Luis Miguel Viana 04.05.2018 в 21:08
source

2 answers

0

with datepicker in jquery you do it this way, when you press the button that makes the function put this additional

$("#boton_accion").click(function(){
     $("#txtFechaF").val('')
})

but with the select I can not think of anything, but if you are using the library select2 I suggest this

$("#select").select2({
    allowClear:true
})

this allows you to add an x to eliminate everything you have selected, I hope it has served you well

    
answered by 04.05.2018 в 21:17
0

To reset the datePicker:

$('#txtFecha1').val("").datepicker("update");

To reset the multiple select:

$("#selAnalisis option:selected").prop("selected", false);
    
answered by 04.05.2018 в 21:27