TSCAmerica.com
TSCAmerica.com

Reputation: 5377

Jquery Calendar without Textbox

enter image description here

I am trying to remove the textbox from the Jquery calendar, how do I hide the textbox so that there is just the calendar icon.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Icon trigger</title>
  <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="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#datepicker" ).datepicker({
      showOn: "button",
      buttonImage: "images/calendar.gif",
      buttonImageOnly: true,
      buttonText: "Select date"
    });
  } );
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>

Upvotes: 0

Views: 580

Answers (2)

Tariq Javed
Tariq Javed

Reputation: 481

Add this css:

#datepicker{
display:none
}

Upvotes: 2

joero4
joero4

Reputation: 220

You could simply set the text box type to "hidden", and then the box won't show, but you will still have a place to store the value.

<input type="hidden" id="datepicker">

Upvotes: 2

Related Questions