Call Javascript function from HTML

Call Javascript function from HTML can be done in following ways

  1. Call javascript function from HTML button click
  2. Call javascript function from HTML form submission
  3. Call javascript function from HTML on onload event
  4. Html call javascript function with parameters

Call javascript function from HTML button click

Here in HTML, a button is created on the button’s click event a method hello() is called.

Call javascript function from HTML form submission

We are calling a method check() on form submission.

Whenever user click on submit button the method check() is get called.

Call javascript function from HTML on onload event

Onload, event can be used to call a function when the page is loaded.

Html call javascript function with parameters

Call javascript function from HTML button click Getting the value using getElementById() in function

Read More

Datatype in JavaScript

Javascript jquery checkbox checked, unchecked, ischecked