xadrus1799
xadrus1799

Reputation: 17

Use javascript function with onclick on an input field

So I have a submit form and want an alarm that pops up after the user send the form.

Heres the part of code that's not working for me

HTML

<div class="col-md-12">
  <input onclick="formSuc" type="submit" class="btn btn-box" value="ABSENDEN">
</div>

<script>
  function formSuc(){
    alarm("test");
    }
  </script>

Upvotes: 0

Views: 1606

Answers (1)

Spectric
Spectric

Reputation: 32002

Use parenthesis when calling a function:

<div class="col-md-12">
  <input onclick="formSuc()" type="submit" class="btn btn-box" value="ABSENDEN">
</div>

<script>
  function formSuc() {
    alert("test");
  }
</script>

Upvotes: 2

Related Questions