Page 1 of 1

Identifying Javascript

Posted: 02 Apr 2019, 09:40
by 22walter_m
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>

Re: Identifying Javascript

Posted: 22 May 2019, 09:05
by Mr. MacKenty
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>