0

I am using node js to to create the server. I want to render mobile.ejs if screen size is shorter beyond some point or else I want to render dashboard.ejs.

This is what I tried

if($(window).width()>414){
        res.render("dashboard");
      }
      else{
        res.render("mobile");
      }

I have required jquery using npm in app.js file but the argument $(window).width() is returning 0 instead of the size of the browser. Please tell where did I go wrong or suggest a better solution

0 Answers0