Answer the question
In order to leave comments, you need to log in
How to encapsulate js file for specific module in nodejs?
In general, there is a module, let's say login.ejs + login.js.
Question: how to make login.js scope only at login.ejs level?
In other words, how to make it so that if there are 2 .button classes on the page, then the $('.button') call would only find the one in login.ejs?
PS: .ejs is an html file.
More:
If the user is not registered, then I include registration:
<% if (!registered) { %>
<%= include login.ejs %>
<% } %>
<script type="text/JavaScript" src="./javascripts/login.js"></script>
<div class="row small-4 panel">
<label>Login
<input class="login" type="text" placeholder="Login" />
</label>
<label>Password
<input class="password" type="text" placeholder="Password" />
</label>
<a href="#" class="enter button small small-12">Login</a>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question