I am trying to use Javascript in my RoR4 app.
The problem I have is that when there are 2 if-conditions, the second one always get executed even it shouldn't be.
Here is my code:
$(document).ready(function() {
if (document.body.contains('individual'))
{
alert('first');
} else if (document.body.contains('main'))
{
<% if current_user.activated%>
alert('not activated');
<% else %>
alert('activated');
<% end %>
}
})
Aucun commentaire:
Enregistrer un commentaire