简体   繁体   中英

prevent jquery datepicker from redirecting on date click

I have initialized datepicker on input type element.

On clicking any dates, it automatically redirects to base-url of the project.

localhost/my-project/#

I have used the plug-in other pages too but it worked fine.

Here's the input element. This element gets hidden initially, and later displayed via javascript.

<input class="editInput date form-control input-sm" type="text" name="date" value="<?php echo $menu['date']; ?>" style="display: none;">

jquery DatePicker initialization:

<script type="text/javascript">
     $('input[name="date"]').datepicker({
       dateFormat: 'yy-mm-dd'
     });
</script>

Could it because the element is hidden initially in DOM?

How do I fix it?

在 jquery-Ui 中找到类 'ui-datepicker-next ui-corner-all' 然后你可以看到锚标签,现在你只需要添加 href='#'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM