Завершен

Need help with Javascript code, works on Desktop but not mobile

Job Description:

I have some Javascript code for a form input field. The code adds a '$' whenever click/focus on the input field, and also adds commas to properly format numbers (ex. $1,000,000).

The code works fine on desktop, but the '$' and commas do not work when I am on mobile device.

This is the code:

<input type="text" id="annual_salary" name="annual_salary" placeholder="Annual Salary" oninput="setCustomValidity('')" >

<script>

$('#annual_salary').on('keyup change focus click input paste',(function (event) {

$(this).val(function (index, value) {

return '$' + [login to view URL](/(?!\.)\D/g, "").replace(/(?<=\..*)\./g, "").replace(/(?<=\.\d\d).*/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");

});

}));

var dollar1 = [login to view URL]('#annual_salary');

[login to view URL]('blur', function(e){

if ([login to view URL] == '$'){

[login to view URL] = '';

}

});

</script>

Attached are pictures of the described area.

Навыки: JavaScript, jQuery / Prototype, HTML, PHP, CSS

О клиенте:
( 61 отзыв(-а, -ов) ) Middle Village, United States

ID проекта: #35819929

Поручен:

wadielnatrontv

i can help you to fix that right now Hi there ? How are you? This is Qandil I am a Web ? / Mobile ? developer, My resume [login to view URL] Having over 4 Больше

$20 USD за 1 день
(53 отзывов(-а))
5.1

13 фрилансеров(-а) готовы выполнить эту работу в среднем за $25

aryan151

Hello Sir Hope you doing well I just checked your project details ✅✅ Need help with Javascript code, works on Desktop but not mobile ✅✅ and It matches my expertise. I have 14+ years of experience in this field. My sk Больше

$20 USD за 1 день
(468 отзывов(-а))
7.2
cmonsalve27

I am Carlos Monsalve specialist in graphic design, development of online stores, web software and websites. I have more than 9 years of experience in the IT and development area, I have a portfolio with more than 500 s Больше

$20 USD за 1 день
(51 отзывов(-а))
5.4
castillajoselui3

Hello! I’m Joseluis, I deliver high standard and outstanding service, good price and you get amazing satisfaction! I promise to do a great job on your project! No Stress. All the best.

$20 USD за 1 день
(35 отзывов(-а))
5.3
franciscoisaque4

****Start immediately.**** I'm a professional web developer. I'm sure I will complete your project perfectly. Let's discuss more details in chat. thanks.

$50 USD за 1 день
(5 отзывов(-а))
3.2
jeetparekhnmims

Hello, I am excited to apply for this project and believe that my skills and experience make me the perfect fit. I am highly motivated and committed to delivering top-quality work. I am also available to start immediat Больше

$50 USD за 1 день
(2 отзывов(-а))
2.3
JoelBamz

Hello, I am a proficient Javascript developer and I have solid experience with form, I can fix this in no time.

$20 USD за 7 дней(-я)
(2 отзывов(-а))
0.8
griffin716

im pretty sure your problem may be caused by the fact that the code is using the jQuery library, which is not present on your mobile device. if you accept my proposal i will give you specific code and steps of how to e Больше

$20 USD за 1 день
(0 отзывов(-а))
0.0
MedPPT

HELLO, I found what you need !!!!!!!!! it appears that the issue is with the event listeners used in the JavaScript code. The code is using the events 'keyup', 'change', 'focus', 'click', and 'input' to trigger the for Больше

$20 USD за 1 день
(1 отзыв)
0.0
fdqz

Seems a rather quick problem to solve. Looking forward to see more of it and get hands on the problem

$15 USD за 1 день
(0 отзывов(-а))
0.0