Try to search your question here, if you can't find : Ask Any Question Now ?

time input validation with start time and end time using javascript

HomeCategory: stackoverflowtime input validation with start time and end time using javascript
Avatarpushpa asked 2 weeks ago

I want to add start time and end time dynamically using JavaScript:

Below is the code:

HTML:

<table id="timeTable" style="border: 1px solid black">
  <tr>
    <td>
      <input type="text" placeholder="Enter Start Time" value="" id="vTime" class="vTime" />
    </td>
    <td>
      <input type="text" placeholder="Enter End Time" value="" id="vTime" class="vTime" />
    </td>
    <td>
      <input type="button" value="Delete" />
    </td>
  </tr>
</table>

JS:

$('#timeTable').on('click', 'input[type="button"]', function () {
  $(this).closest('tr').remove();
});

$('#add-more').click(function () {
  var vTime = $(".vTime:last-child").last().val();
  $('#myTable').append('<tr><td><input type="text" placeholder="Enter Start Time" class="vTime" /></td><td><input type="text" placeholder="Enter End Time" value="" id="vTime" class="vTime" /></td><td><input type="button" value="Delete" /></td></tr>');
});

If I enter start time and end time first time then end time should not be less that start time, when I enter second row for start and end time then it should not be less than previous time and so on….

Can anyone please help?

1 Answers
Best Answer
AvatarMannu answered 2 weeks ago
Your Answer

10 + 12 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com