Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
javascript on onclick="return func();" stop working after first element by id
<button onclick="return validateEdit();" class="btn btn-primary submit-btn">Submit</button>

function validateEdit() {
  var name = document.getElementById("sftName").value;
  aler("name")
  var startTime = document.getElementById("startTimeEdit").value;
  aler("start time")
}

The function execute first alert and don't show second aler.I am using also:

$('#edit_shift').on('show.bs.modal', function (event) {
  var anchor = $(event.relatedTarget) // Button that triggered the modal
  var id = anchor.data('whatever')
  var from = anchor.data('fromtime')
  var modal = $(this)
  $("#sftName").attr("value", name);
  $("#startTimeEdit").attr("value", from);

In the another form is working fine.

Edit: start time with value and without value is not working in both cases.

I am full zero at javascript.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

There are some typo error. Make sure its alert in your code and not aler. Also html content you posted having only button, whereas you are trying to fetch two elements with id sftName and startTimeEdit, make sure those elements are there in your code. For better understanding can you recreate above issue on codepen.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!