diff --git a/data/assets/js/job-new.js b/data/assets/js/job-new.js index d8389c2da32431..041886da56fd4b 100644 --- a/data/assets/js/job-new.js +++ b/data/assets/js/job-new.js @@ -93,6 +93,15 @@ Site.Job.New.init = function() { return false } + function removeWhiteSpaces(event) { + let rgxMoney = /^[$]?([0-9]{1,3}.([0-9]{3}.)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$|([0-9]{1,3}.([0-9]{3}.)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?k/ + let valueMoney = event.target.value + if (!rgxMoney.test(valueMoney)) { + $E('#new-job #salary').value = '' + } + } + let $form = $E('#new-job form') $form.querySelector('button[data-type="submit"]').addEventListener('click', submitEvent) + $E('#new-job #salary').addEventListener('change', removeWhiteSpaces) }