admin管理员组文章数量:1353618
All the answers I could find are for Datepicker and it doesn't work the same!
It only fires an onChange() event if I modify the value with the keyboard and not the bootstrap interface.
I've tested everything showed here
My code:
JAVASCRIPT
$(function () {
//Date range picker
$('#reservation').daterangepicker({
onSelect: function() {
$(this).change();
}
});
});
$(document).ready(function () {
$("#reservation").change(function () {
var date = $("#reservation").val();
var replaced = date.split(' ').join('')
$("#partialtable").load('@(Url.Action("GetDateResults", "Temps", null, Request.Url.Scheme))?date=' + replaced);
});
});
HTML
<!-- Date range -->
<div class="form-group">
<label>Période:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="reservation" onchange=""/>
</div><!-- /.input group -->
</div><!-- /.form group -->
Anyone can find a solution please? I don't mind to trigger the event even if the change is the same value as before!
All the answers I could find are for Datepicker and it doesn't work the same!
It only fires an onChange() event if I modify the value with the keyboard and not the bootstrap interface.
I've tested everything showed here
My code:
JAVASCRIPT
$(function () {
//Date range picker
$('#reservation').daterangepicker({
onSelect: function() {
$(this).change();
}
});
});
$(document).ready(function () {
$("#reservation").change(function () {
var date = $("#reservation").val();
var replaced = date.split(' ').join('')
$("#partialtable").load('@(Url.Action("GetDateResults", "Temps", null, Request.Url.Scheme))?date=' + replaced);
});
});
HTML
<!-- Date range -->
<div class="form-group">
<label>Période:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="reservation" onchange=""/>
</div><!-- /.input group -->
</div><!-- /.form group -->
Anyone can find a solution please? I don't mind to trigger the event even if the change is the same value as before!
Share Improve this question asked Jun 14, 2017 at 19:33 J. LavoieJ. Lavoie 3343 gold badges5 silver badges24 bronze badges2 Answers
Reset to default 5You can try with this:
<script type="text/javascript">
$(function() {
$('#reservation').daterangepicker({
//singleDatePicker: true,
//showDropdowns: true
},
function() {
var date = $("#reservation").val();
var replaced = date.split(' ').join('')
$("#partialtable").load('@(Url.Action("GetDateResults", "Temps", null, Request.Url.Scheme))?date=' + replaced);
});
});
</script>
I hope it will work for you!!
<script type="text/javascript">
$(function() {
$('#reservation').daterangepicker({
//singleDatePicker: true,
//showDropdowns: true
},
function() {
let date = $(".drp-selected").text()
console.log(date)
});
});
</script>
本文标签: javascriptJQuery Daterangepicker onchange eventStack Overflow
版权声明:本文标题:javascript - JQuery Daterangepicker onchange event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743899421a2558396.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论