Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is inline javascript? [closed]

Me and my programmer has 2 different views for what "Inline JavaScript" is.

  1. I said inline JavaScript means JavaScript placed directly in the HTML file, without in a .JS file.

  2. My programmer means inline JavaScript is JavaScript on 1 line, and like <button onclick="alert('test')">

I give him right in, that inline JavaScript also is "onclick='alert(...)" because it again is like my solution #1, all JavaScript loaded in HTML and not in JS.

Who's right?

We have a HTML file, and there is <script>....</script> JavaScript in the bottom, that is inline javascript, right?

like image 276
helloworld Avatar asked Oct 27 '13 13:10

helloworld


1 Answers

A script tag without a src (ie. with code directly in the HTML document) is referred to as an inline script.

An onclick="..." attribute is called an inline event handler.

like image 100
Niet the Dark Absol Avatar answered Sep 29 '22 11:09

Niet the Dark Absol