Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Amit Sarker
Added: Mar 8, 2018 7:36 AM
Modified: Nov 5, 2018 2:28 PM
Views: 20
Tags: no tags
Different type of JS functions
  1. $(".purchase_price").on("keypress keyup blur", get_numeric_value_input);
  2. function get_numeric_value_input(event) {
  3.     $(this).val($(this).val().replace(/[^0-9\.]/g, ''));
  4.     if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
  5.         event.preventDefault();
  6.     }
  7. }
  8.  
  9. $("#date_installed").datepicker({
  10.         dateFormat: 'dd-mm-yy',
  11.         onSelect: function () {
  12.             var fecha = $(this).datepicker('getDate');
  13.             var day = fecha.getDate();
  14.             var month = fecha.getMonth();
  15.             var year = fecha.getFullYear() + 1;
  16.             var setDate = new Date(year, month, day);
  17.             $("#expire_date").datepicker("setDate", setDate);
  18.         }
  19.     });
  20.