Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:17:58+00:00 2026-06-05T20:17:58+00:00

I tweaked little bit how datetime picker works. It is triggered on change of

  • 0

I tweaked little bit how datetime picker works. It is triggered on change of select.

But now I cannot type into the text box. I use the text box not only for date time but to let user input other type of information in my application.

How can I make user to type into this text box? So all other settings stay as it is. Datepicker is triggered only on select change. Not on clicking the textbox itself.

jsfiddle sample

html code

<input id="datetime" type="text" name="datetime" value="" >
<select size=5>
    <option value="not">Not this one</option>
    <option value="not">Not this one</option>
    <option value="not">Not this one</option>
    <option value="datetimepicker">Select date and time</option>
</select>​

javascript code

$('#datetime').datetimepicker({
    showOn: "button",
});
$('option[value=datetimepicker]').click(function() {
    $('#datetime').datetimepicker('show');
});
​

css code

.ui-datepicker-trigger{display:none;}​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:18:01+00:00Added an answer on June 5, 2026 at 8:18 pm

    This your code disable your INPUT by default and make datetimepicker “button” from it, that why you can’t print text inside INPUT field:

    $('#datetime').datetimepicker({
        showOn: "button",
    });
    

    Let’s look further:

    $('option[value=datetimepicker]').click(function() {
      // This part of code will work when you click inside SELECT field
    }
    

    So, you need to transform your input into datetimepicker when you click inside SELECT, true?

    To do this, you just move inicialization of datetimepicker inside previouse block:

    $('option[value=datetimepicker]').click(function() {
        $('#datetime').datetimepicker({
            showOn: "button",
        });
        $('#datetime').datetimepicker('show');
    });
    

    Now you can type inside input, untill SELECT was pressed. When SELECT was pressed, datapicker starts and your text in INPUT field disappear.

    Here is modified fiddle: http://jsfiddle.net/dPRjS/9/


    UPDATED:

    To add possibility to edit INPUT after datetimepicker was closed, you need to destroy created datetimepicker on field INPUT, to return it to possibility work as INPUT:

    You need to activate this action when you click on INPUT field:

    $('#datetime').click(function(){
         $('#datetime').datetimepicker( "destroy" );
     });
    

    Working updated fiddle: http://jsfiddle.net/dPRjS/10/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a jquery function online that i then tweaked a little, but it
I found this code online and tweaked it a bit for my need to
I am not a PHP programmer but have tweaked some in the past. How
Using this code (tweaked a little) i can't get a constant Y value. it
I tweaked my statusline in vim a little, and started to like it. I
Now that iOS 6 has come out and tweaked some control appearances, my Default.png
I tweaked this script that I used from JqueryUi and I have a problem.
I have tweaked the standard jelly template to display the current test results in
I have a client who wants his script to be tweaked for some modifications.
We're using a Oracle Text CTXSYS.CONTEXT index to index about half a million rows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.