0

There's also an error where I try to run multiple functions onclick.

<img onclick="showMore(); displayArtwork()" id = "charcoalimg" src = "images/charcoal.png" alt="image">

Javascript:

function displayArtwork(){
var totalimg;

// get total number of images in painting's directory
var fs = require('fs');
fs.readdir( 'Code/girl', function(error, files) { 
    var totalimg = files.length; // return the number of files
    console.log(totalimg); // print the total number of files
 });
Karen C
  • 57
  • 1
  • 7
  • 3
    fs is only available in Node, not the browser. – Phix Aug 08 '20 at 01:54
  • 2
    As @Phix already mentioned, `fs` package is only available in node.js. For multiple functions on `onclick` event see this https://stackoverflow.com/questions/3910736/how-to-call-multiple-javascript-functions-in-onclick-event/ – Kartik Chauhan Aug 08 '20 at 01:57

0 Answers0