skip to Main Content

input type date format should be 12-mar-23 even if user type 12-03-23 – Jquery

(function() { $('#submit').on('click', function(){ var date = new Date($('#date-input').val()); day = date.getDate(); month = date.getMonth() + 1; year = date.getFullYear(); alert([day, month, year].join('/')); }); })(); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="date" id="date-input" required /> <button id="submit">Submit</button> In input date, format should be…

VIEW QUESTION

how to append text to its own div container without appending it to the other div container? – Jquery

what the jquery code does below is it only clears the textbox $(document).ready(function(){ var someText = $(".someText"); $(".add").on("click", function(){ $(".container", this).append(someText.val()); $(someText).val(""); }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="container"> <div class="add">+</div> <input class="someText" type="text"> </div> <div class="container"> <div class="add">+</div> <input class="someText"…

VIEW QUESTION
Back To Top
Search