Identifying Javascript

Designing Solutions Through Programming. This course is also called introduction to programming.
Forum rules
Please be careful about sharing personal information. Never use any identifiable information.
Post Reply
22walter_m
New User
Posts: 1
Joined: 02 Apr 2019, 09:33

Identifying Javascript

Post by 22walter_m » 02 Apr 2019, 09:40

Is the section below javascript or simply a css element?

Code: Select all

<script>
document.getElementById("myBtn").onclick = function() {myFunction()};

function myFunction() {
  document.getElementById("myDropdown").classList.toggle("show");
}
</script>
0 x

User avatar
Mr. MacKenty
Site Admin
Posts: 88
Joined: 28 Apr 2018, 17:06
Answers: 3

Re: Identifying Javascript

Post by Mr. MacKenty » 22 May 2019, 09:05

In general, anything wrapped in a script tag is javascript. Javascript can alter CSS. In the code snippet you provided below, it looks like clicking on a button shows a div with an id called "myDropDown".
22walter_m wrote:
02 Apr 2019, 09:40
Is the section below javascript or simply a css element?

Code: Select all

<script>
document.getElementById("myBtn").onclick = function() {myFunction()};

function myFunction() {
  document.getElementById("myDropdown").classList.toggle("show");
}
</script>
0 x

Post Reply