How can I change position of where the calendar pops up. I am using the below code and the calendar pops up to the far left.
I need it to pop up over the input field.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<!-- jQuery -->
<script src="../datepicker/jquery-3.1.1.min.js" type='text/javascript'>
</script>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" type="text/css">
<link href='../datepicker/bootstrap/css' rel='stylesheet'
type='text/css'>
<script src=../datepicker/bootstrap/js/bootstrap.min.js
type='text/javascript'></script>
<!-- Datepicker -->
<link href='../datepicker/bootstrap-datepicker/dist/css/bootstrap-
datepicker.min.css' rel='stylesheet' type='text/css'>
<script src='../datepicker/bootstrap-datepicker/dist/js/bootstrap-
datepicker.min.js' type='text/javascript'></script>
</head>
<body>
<div class="container">
<div align="center">
<h4>Date Range for Chart</h4>
<form method="post" action="mychart2.php">
<p>Start Date: <input type="text" name = "start" data-provide="datepicker"
data-date-format="yyyy-mm-dd"></p>
<p>End Date: <input type="text" name = "end" data-provide="datepicker"
data-date-format="yyyy-mm-dd"></p>
<br>
<input type="submit" name="submit" value="Submit">
</form>
</div>
</div>
</body>
</html>
I not sure I can control the position by using data-provide
First, make sure that you use the Bootstrap CSS. It seems that the Bootstrap is not loaded properly.
You can set the HTML property data-date-orientation according to the documentation:
A space-separated string consisting of one or two of “left” or “right”, “top” or “bottom”, and “auto” (may be omitted); for example, “top left”, “bottom” (horizontal orientation will default to “auto”), “right” (vertical orientation will default to “auto”), “auto top”. Allows for fixed placement of the picker popup.
Each option attribute has to have the data-date- prefix.
The distance to the input field may be controller by setting the margin.
Related
I'd need to insert a checkbox in my code by using the Materialize css library.
My html
<head>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<main>
<div class="container " style="padding-left: 2vw;">
<div class="params_container">
<form action="#">
<p>
<input type="checkbox" id="test9" />
<label for="test9">Red</label>
</p>
</form>
</div><!-- params_container -->
</div>
</main>
This code just shows the label text "Red" and no checkbox.
I've read in other posts that in Materialize css v. 1.0.0 the checkbox shows only by using <span>Red</span> and not <label>Red </label>. With <span> the checkbox does render indeed but it can't be checked if clicked.
Does any of you know what I'm missing?
I have this weird issue where when I copy and paste into my index.html file in atom, it makes the html code turn gray. This issue only happens when I copy and paste. It doesn't appear to be related to anything in terms of code since this happens regardless of what project I'm working on. If I don't copy and paste into Atom, this issue doesn't happen. It ONLY happens when I copy and paste. I end up running to the issue always since I need to copy and paste the links to libraries for bootstrap, jquery etc. If I can't figure it out, it's such a nuisance that I'm going to switch IDE's for web development. I've even tried uninstalling and reinstalling Atom which didn't help. Even though it's not related to code, here's an HTML file that I just worked on where it's happening.
Any help is much appreciated. Thank you!
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flask App</title>
<link rel="stylesheet" href="../static/styles/style.css" />
<!-- jQuery UI Styles -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous" />
<!-- Bootstrap bundle JS - includes boostrap's own JS plugins and Popper for tooltips and popovers -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
crossorigin="anonymous"></script>
</head>
<body style="background-color: #202020; color: #fff">
<h1 id="mainHeader">Should I buy, sell, or hold this stock?</h1>
<div id="mainContainer" class="container">
<form method="post" id="form">
<!-- Enter stock symbol -->
<input id="stockInput" type="text" name="number" placeholder="Enter stock symbol or name..." size="30" />
<!-- Radio buttons -->
<div id="radioButtonContainerId">
<p>
<label for="isLiveFor" class="radio-inline">
<input type="radio" name="radio" id="isLive" disabled="true" />
Live tweets</label>
<label for="isPastFor">
<input type="radio" name="radio" id="isPastTweet" />
Past tweets</label>
</p>
</div>
<!-- Number of tweets -->
<p>
<input id="numTweetsInput" type="number" name="numTweets" placeholder="Number of tweets" min="1"
max="100000000000000" style="display: none" />
</p>
<!-- Date Range -->
<p>
<input id="numDaysInput" type="number" name="numDays" placeholder="Past days" min="1" max="100000000000000"
style="display: none" />
</p>
<!-- Submit Button -->
<p>
<button class="btn btn-success">Submit</button>
</p>
</form>
</div>
<div class="container" id="percentResults">
<p id="percentage"></p>
<p id="square"></p>
</div>
<!-- 1. jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="../static/custom.js"></script>
</body>
</html>
Atom might not be recognizing the syntax of your code immediately as soon as you paste some new code and its colour seems grey.
Check the bottom right corner of the screen to make sure the atom has the correct language/file extension selected. You can manually select this if atom doesn't it automatically recognises the code language. Try setting from Html to Html(Go) manually or whichever syntax it recognises.
Also, the code turns grey if the file is not saved in the particular file extension.
I found the below code from the website mentioned below after my two-days search for a bootstrap datepicker for my website. Being a newbie I do not know how to implement but I gave it a try, however, I did not get the result as expected, I got only an inputfield but no datepicker. Can somebody help me implement the code?
I create a test.html file in my project and added the below code to test.
NOTE: This is the only code I have for datepicker.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Test Site</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous"> -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<!-- google fonts -->
<link href="https://fonts.googleapis.com/css2?family=Bangers&display=swap" rel="stylesheet">
</head>
<body>
<div class="container my-4">
<div class="md-form">
<input placeholder="Selected date" type="text" id="date-picker-example" class="form-control datepicker">
</div>
</div>
<script>
// Data Picker Initialization
$('.datepicker').pickadate();
</script>
</body>
</html>
Source of the code
In your input tag with id=date-picker-example replace type field with "date". I mean the code of your input field will be like this.
<input placeholder="Selected date" type="date" id="date-picker-example" class="form-control datepicker">
I hope this solves your problem.
I refer to the following example on navbar using Bootstrap:
https://www.w3schools.com/bootstrap4/tryit.asp?filename=trybs_navbar_form&stacked=h
Copying the HTML, I put it in my JSP page. The following is the eventual HTML:
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="/webjars/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/webjars/bootstrap/js/bootstrap.bundle.min.js"></script>
<title>2</title>
</head>
<body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<form class="form-inline" action="/action_page.php">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-success" type="submit">Search</button>
</form>
</nav>
<br>
<div class="container">
<h3>Navbar Forms</h3>
<p>Use the .form-inline class to align form elements side by side inside the navbar.</p>
</div>
</body>
</html>
On both IE and Google Chrome, the navbar's height is bigger than the one in the example, with the extra spaces below the controls, as shown below. I found that this is due to the button. If the button is removed, the navbar's height would be the same as in the example. What could be the root cause and how can I resolve it? I am using Bootstrap 4.4.
this is because of the browser default CSS which also known as User Agent Style Sheet.
I found that if you use <!DOCTYPE html> this space was removed because the bottom margin of the form element in HTML5's User agent style sheet is 0px;
If i don't use <!DOCTYPE html> it consider the HTML4's User agent style sheet, and the bottom margin of the form element in it is 1em.
so now choice is yours that if you have to use <!DOCTYPE html> or not.
Otherwise the another solution is that use class="mb-0" in form element it is the bootstrap-4 class to set margin-bottom: 0px; for any element.
Currently I downloaded some CSS/JS files to make my check-boxes pretty (link found at end) and included them in my project. I am looking at his example code for making a check-box button, which is found under his example heading "Button Style". The colors seem to work great but only half of the checkbox is present (top half). I can't seem to figure out why the whole checkbox isn't displaying, but his example is working just fine.
Can someone help me figure out how to get his example working, so I can get a checkbox that toggles from red to green? completely new to bootstrap and help would be appreciated!
Link: http://montrezorro.github.io/bootstrap-checkbox/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example of Twitter Bootstrap</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-checkbox.css" rel="stylesheet">
<style type="text/css">
.bs-example{
margin: 20px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-checkbox.js"></script>
</head>
<body>
<div class="bs-example">
<form class="form-horizontal">
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<div class="checkbox">
<label><input type="checkbox" class = "style3"> Remember me</label>
</div>
</div>
</div>
<script>
$('input[type="checkbox"].style3').checkbox({
buttonStyle: 'btn-danger',
buttonStyleChecked: 'btn-success',
checkedClass: 'icon-check',
uncheckedClass: 'icon-check-empty'
});
</script>
</form>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Edit: Sorry, I don't know how to get the files I downloaded off of the website I posted above on Jsfiddle. I am slapping code together. Obviously you will need to download the code off the website since I imported this. If anyone can tell me how to use jsfiddle while integrating new files, that would be great.