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 9000757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:21:00+00:00 2026-06-16T00:21:00+00:00

my datepicker is work in simple code. after using that in insert new row

  • 0

my datepicker is work in simple code. after using that in insert new row of <tr> not work in click. but i can get object of that in first click into <input/>.
thats work when clicking other input and try again to click for showing popup of datepicker.

My jQuery:

$('#myTable tr:last').after("<tr><td align='center'style='background-color:"+rcolor+"'>"+rowCount+
            "</td><td><input style='width:300px !important;' name='onvan' /></td>"+
            "<td><input style='width:100px !important;' name='' id='startdate'/></td>"+
            "<td><input style='width:100px !important;' name='' id='enddate'/></td>"+
            "<td><input style='width:100px !important;' name='' id='' /></td>"+
            "<td>"+
            "<select name='visible'>"+
            "<option></option>"+
            "<option></option>"+
            "<option></option>"+
            "<option></option>"+
            "<option></option>"+
            "<option></option>"+
            "</select></td>"+
            "<td><select name='visible'><option value='1' >فعال</option><option value='0' >غیرفعال</option></select>"+
            "&nbsp;&nbsp;<span id='saveToDb'><a href='#'>ذخیره</a></span>&nbsp;<span id='cancelToSave'><a href='#'>لفو</a></span></td>"+
            "</tr>");

DATAPICKER:

$(function() {
    $('#startdate').live('click', function() {
        // alert( $(this));

             $(this).datepicker({
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: 'yy/mm/dd',
                minDate: '-3y',
                maxDate: '+3y',
                regional: 'fa',
                onSelect: function (dateText, inst) {
                         var date = new JalaliDate(inst['selectedYear'], inst['selectedMonth'], inst['selectedDay']).getGregorianDate();
                          var month= (date.getMonth()+1).toString(); 
                          if (month.length <2) month='0'+ month; 

                          var day= date.getDate().toString(); 
                          if (day.length <2) day ='0'+ day;
                          $('#taTarikh').val(date.getFullYear() + '-' + month + '-' + day);
                          // alert($('#taTarikh').val());
                }
             });    
          });                 
});
  • 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-16T00:21:01+00:00Added an answer on June 16, 2026 at 12:21 am

    With .live('click',function(){}); you are implementing datepicker by your first click thats why it starts working at second click.

    You should implement datepicker after you create the object..

    $(function() {
        $('#myTable tr:last').after("<tr><td align='center'style='background-color:yellow'>3</td><td><input style='width:300px !important;' name='onvan' /></td>" + "<td><input style='width:100px !important;' name='' id='startdate'/></td>" + "<td><input style='width:100px !important;' name='' id='enddate'/></td>" + "<td><input style='width:100px !important;' name='' id='' /></td>" + "<td>" + "<select name='visible'>" + "<option></option>" + "<option></option>" + "<option></option>" + "<option></option>" + "<option></option>" + "<option></option>" + "</select></td>" + "<td><select name='visible'><option value='1' >فعال</option><option value='0' >غیرفعال</option></select>" + "&nbsp;&nbsp;<span id='saveToDb'><a href='#'>ذخیره</a></span>&nbsp;<span id='cancelToSave'><a href='#'>لفو</a></span></td>" + "</tr>");
        $("#startdate").datepicker({
            changeMonth: true,
            changeYear: true,
            showButtonPanel: true,
            dateFormat: 'yy/mm/dd',
            minDate: '-3y',
            maxDate: '+3y',
            regional: 'fa',
            onSelect: function(dateText, inst) {
                var date = new JalaliDate(inst['selectedYear'], inst['selectedMonth'], inst['selectedDay']).getGregorianDate();
                var month = (date.getMonth() + 1).toString();
                if (month.length < 2) month = '0' + month;
                var day = date.getDate().toString();
                if (day.length < 2) day = '0' + day;
                $('#taTarikh').val(date.getFullYear() + '-' + month + '-' + day);
                // alert($('#taTarikh').val());
            }
        });
    });
    

    Demo: http://jsfiddle.net/BerkerYuceer/pBQFF/14/

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

Sidebar

Related Questions

I am trying to get bootstrap datepicker to work but it does not even
I am trying out the jquery datepicker but can't get it to work. I
I can't get the jQuery datepicker to work. I have followed everything from the
I have a very simple page that's using jquery's datepicker. I have: <input id=datepicker
I got Jquery UI Datepicker that work well, but one important issue make me
I am trying to get jquery-ui datepicker to work with highcharts so that a
I am looking for a JQuery DatePicker with a time picker which can work
I have a datepicker and it can not allow dates prior to today VIA
I am using bootstrap-datepicker and get a value of 1339698600000 for the selected date
I am using the jQuery Datepicker without any problem for TextBox controls that are

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.