In the below code i have a jquery datepicker.I tried to implement in bootstrap modal .But it is not working .Pls help me to solve the issue.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id$=txtdob]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: 'images/calendar.gif'
});
});
</script>
<input type="text" style="width:30%" id="txtdob" name="nmdob" class="form-control" runat="server" placeholder="Dob" />
You have to call the function in the body onload() because on bootstrap, the elements are not initialized yet, so you cannot access the DOM.
change
$("[id$=txtdob]").datepicker({
to
$("#txtdob").datepicker({
and put it in $(document).ready...
Related
so what I'm trying to do is to make a popup calendar by textbox by using datepicker. the problem that I faced is the calendar doesn't popup at all .
below is my code:
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type ="text/javascript" >
// <script type="text/javascript" language="javascript">
$(function () {
//initialise the datepicker with the date format specified
$(".datepicker").datepicker();
</script>
next:
<input id="txtSche1" type="text" CssClass="datepicker" readonly="readonly"/>
so I try other method but but this time I'm using image button and it worked
$(function () {
$("[id$=txtSche1]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '../images/PopUpSmallCalendar.gif',
});
});
I also remove the class from the text input
<input id="txtSche1" type="text" readonly="readonly"/>
I have searched for this error, in the context of jQuery and data tables, and none of the suggestions worked (in case this is marked duplicate immediately!)
I have .Net project (C#) and in master page I have references to jQuery, Datatables and date picker (among other things):
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-json/2.6.0/jquery.json.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.14.30/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<link href="assets/themes/base/jquery.ui.all.css" rel="stylesheet" />
In a page that uses the the master page I have a datatable and date pciker. I also try to set the modal pop up's title to be draggable. Using any of them causes "Object does not support property or method xxxx" error, where xxxx can be "draggable", "dataTable" or "datepicker".
I can't see why I get the errors when I am referencing jQuery. I even tried the ".noConflict" approach but it did't help either.
<script>
function pageLoad() {
$('#tbStartDate').unbind();
$("#tbStartDate").datepicker({
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "../assets/images/calendar.gif",
buttonImageOnly: true,
buttonText: "Select Statrt Date",
option: "mm/dd/yy",
onSelect: function (dateStr) {
$("#tbEndDate").val(dateStr);
$("#tbEndDate").datepicker("option", { minDate: new Date(dateStr) })
}
});
}
</script>
or
<script>
$(document).ready(function () {
var j$ = jQuery.noConflict();
j$(".modal-dialog").draggable({
handle: ".modal-header"
});
})
</script>
Try...
$(window).load(function(){
})
instead of document.ready.
In the "Scripts" folder of the project, I had jquery-1.10.2.js and jquery-1.10.2.min.js while in my master page I was referencing jQuery 1.12.4. Once I removed the 1.10 scripts from"Scripts" folder, the error went away.
Thank you nitsram and Brahma for taking time and responding; I up-voted your responses.
I want to show datepicker in input box.4 days before This code show datepicker.Now I modified unknownly.I dont know What I changed.Here I attached my code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://www.jscodes.com/codes/calendar_javascript/demo/css/datePicker.css" />
<script src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery.datePicker-min.js" type="text/javascript"></script>
<title>Content Delv Logs</title>
<script type="text/javascript">
$(window).ready(function() {
$('#date-pick').datePicker({clickInput: true});
});
</script>
</head>
<body>
<input type="text" name="date" id="date-pick" value=""/>
</body>
Add this link in your head tag. You are missing jQuery UI library:
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
$(function() {
$( "#datepicker" ).datepicker();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<p>Date: <input type="text" id="datepicker"></p>
use jquery UI with alot of functions and more to give;;;
http://jqueryui.com/
http://jqueryui.com/datepicker/
You just need to enable jQuery UI.
Have a look at this JSFiddle
$(function() {
$( "#datepicker" ).datepicker();
});
Please note how jQueryUI is enabled.
Always getting an error whenever I try to create a datepicker in my form. Can anyone help me out? I believed I have referenced the proper CSS, JS, Bootstrap and JQuery files.
<script src="js/jquery-2.1.1.js"></script>
<link href="css/animate.min.css" rel="stylesheet" />
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/color2.css" rel="stylesheet" />
<link href="css/font-awesome.min.css" rel="stylesheet" />
<link href="css/font_google.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<link href="css/bootstrapValidator.css" rel="stylesheet" />
<link href="css/bootstrapValidator.min.css" rel="stylesheet" />
<script src="js/bootstrapValidator.js"></script>
<script src="js/bootstrapValidator.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/PageValidator.js"></script>
<script src="js/Validator2.js"></script>
<link href="css/datepicker.css" rel="stylesheet" />
<script src="js/bootstrap-datepicker.js"></script>
here's my attempt at creating a datepicker
<div class="form-group">
<label for="Birthday">Birth Date</label>
<div class="input-group">
<span class="input-group-addon flat">
<span class=" glyphicon glyphicon-calendar"></span>
</span>
<div class="input-group date" id="dobPicker" data-date-format="MM/DD/YYYY">
<input type="text" class="form-control" id="birthday" name="birthday" placeholder="MM/DD/YYYY"
data-bv-notempty="true" data-bv-notempty-message="Birth Date is required and cannot be empty"
data-date-format="MM/DD/YYYY" data-bv-date-message="Invalid Date" />
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#birthday').datetimepicker({
pickTime: false
});
});
</script>
Any insight (and possibly a code fix) would be greatly appreciated!!
I know i am 2 years late to the party, but i just had the problem and found 'a' solution that might help someone in the future.
I got an error of undefined method because i loaded the wrong .js file out of the bundle.
I loaded jquery.datetimepicker.min.js out of the root dir from the package instead of jquery.datetimepicker.full.min.js out of the build folder.
If its bootstrap date Time picker use the following code :
$(function () {
$('#birthday').datepicker()({
pickTime: false
});
});
Fiddle : http://jsfiddle.net/QD94K/1/
I had the same problem. In my case I fixed it by adding:
<script src="Scripts/jquery-ui-1.10.4.js"></script>
Assuming you're using this datepicker, you should select the containing div instead of the input element.
$(function () {
$('#dobPicker').datetimepicker({
pickTime: false
});
});
You have to add - jquery_calendar/jquery-ui.js
<script type="text/javascript" src="Scripts/jquery_calendar/jquery-ui.js"></script>
or
<script src="Scripts/jquery-ui-1.10.4.js"></script>
then add JQuery code
$(document).ready(function () {
$('.openCalendar').datepicker({
closeText: "Select",
changeMonth: true,
changeYear: true
});});
if Jquery Ui is not there Calander will not works.
How can the two will run?.If I put first the datepicker the bxslider will not run and if the bxslider I put first the datepicker wil not run..thanks..
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function(){
$( "#datepicker" ).datepicker();
$("#icon").click(function() {
$("#datepicker").datepicker( "show" );
})
});
</script>
<!-- bxslider -->
<link href="bxslider/jquery.bxslider.css" rel="stylesheet" />
<script src="bxslider/jquery.js"></script>
<!-- bxSlider Javascript file -->
<script src="bxslider/jquery.bxslider.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.bxslider').bxSlider({
auto: true,
});
});
</script>
How can the two will run?.If I put first the datepicker the bxslider will not run and if the bxslider I put first the datepicker wil not run..thanks..
You're including jQuery twice. Don't do that; including jQuery a second time will overwrite the jQuery object and any plugins that have been attached to it. Include jQuery only once and then include your plugins.
<head>
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css" />
</head>
<body>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script src="js/jquery.bxslider.min.js"></script>
<link href="css/jquery.bxslider.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function(){
$('.bxslider').bxSlider();
$('.datepicker').datepicker({
showOn: 'button',
buttonImage: 'images/dp.png',
buttonImageOnly: true,
});
});
</script>
</body>