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

146
Views
Button onload calls function

I have the following button

<button type="button"
  title="Previous value:"
  ***onload="test()"***
  class="btn btn-warning mb-2" style="padding: 4px 8px 4px 8px; border-radius: 1rem;">
 <i class="fas fa-exclamation-triangle text-white"></i>
</button>

Which I want it when it loads to call the test() function

function test() {
    console.log("I am in");
}

in reality this function will be creating a popover. But it doesnt seem to be calling the function. (No, onclick or hover is not helping me.)

Any suggestions, ideas how to achieve that?

Many thanks in advance.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

onload event is only supported on these HTML tags:

<body> <iframe> <img> <input type="image"> <link> <script> <style>

take a look at: HTML onload attribute

about 4 years ago · Juan Pablo Isaza Report

0

    <button type="button" title="Previous value:" onclick="test()" class="btn btn-warning mb-2" style="padding: 4px 8px 4px 8px; border-radius: 1rem;">
 <i class="fas fa-exclamation-triangle text-white"></i>
</button>

<script>

function test(){
    //alert("test");
    console.log("I am in");
}
</script>`enter code here`
about 4 years ago · Juan Pablo Isaza Report

0

Try using Ajax and call the function by id or class by button click.

about 4 years ago · Juan Pablo Isaza 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!