index.html.erb
<div id="app-back-button">
<%= link_to image_tag("back.png",:border => 0), 'javascript:history.go(-1);' %>
</div>
Above mentioned code triggers back action when back button is clicked.
index.html.erb
Below mentioned code is used to hide and show the div contents.
<a href="#">LINK</a>
<div id = "test">
<h2>Import Statements</h2>
<%= form_tag import_xvaziris_path, multipart: true do %>
<%= file_field_tag :file %>
<%= submit_tag "Import" %>
<% end %>
</div>
<script language="javascript" type="text/javascript">
$( document ).ready(function() {
$("div#test").hide();
$("a").click(function(event) {
event.preventDefault();
$("div#test").toggle();
});
});
</script>
Now the problem is that when I click the back button, it triggers hide/show functionality and do not go backwards.
Any suggestions are most welcome.
Thank you in advance.
Full index view is as below;
index.html.erb
<div id="content_header">
<h1 id="main_heading">XTEP Vaziri Statement</h1>
<div id="app-back-button">
<%= link_to image_tag("back.png",:border => 0), 'javascript:history.go(-1);' %>
</div>
</div>
<br>
<a href="#">...</a>
<div id = "test">
<h2>Import Statements</h2>
<%= form_tag import_xvaziris_path, multipart: true do %>
<%= file_field_tag :file %>
<%= submit_tag "Import" %>
<% end %>
</div>
<script language="javascript" type="text/javascript">
$( document ).ready(function() {
$("div#test").hide();
$("a").click(function(event) {
event.preventDefault();
$("div#test").toggle();
});
});
</script>