It could be that I just need a new pair of eyes because I'm missing something. but this is driving me nuts. I'm trying to hide a simple table which is populated with information from a rails controller and the hide me开发者_如何学JAVAthod just will not work!
I'm guessing its got to be my configuration. There must be a file I need similar to jquery.rails.js or something to use it.
Heres my HTML:
<div id="hidden-div" style="">
<table id ="hidden-content-table" style="">
<thead>
<tr>
<td>Links:</td>
<td>Occurence:</td>
</tr>
</thead>
<tbody>
<% @hashToShow.each_with_index do|k,v,index|%>
<tr class = "values-from-ruby">
<td class = "keys" id = "key<%=index%>"><%=k%></td>
<td class = "values" id = "value<%=index%>"><%=v%></td>
</tr>
<%end%>
</tbody>
</table>
</div>
Not forgetting the include tags at the top
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", "jquery.rails.js"%>
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"%>
<%= javascript_include_tag "siteSummary.js" %>
<%= javascript_include_tag "http://www.google.com/jsapi"%>
<%= javascript_include_tag "./siteSummaryJavascripts/siteSummaryInternalLinks.js"%>
<%= stylesheet_link_tag 'siteSummary.css'%>
<%= stylesheet_link_tag 'sitesummaryinternallinks.css'%>
Which generates:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="/javascripts/jquery.rails.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript"></script>
<script src="/javascripts/siteSummary.js?1313580205" type="text/javascript"></script>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script src="/javascripts/./siteSummaryJavascripts/siteSummaryInternalLinks.js?1314181692" type="text/javascript"></script>
<link href="/stylesheets/siteSummary.css?1314098729" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/sitesummaryinternallinks.css?1314123919" media="screen" rel="stylesheet" type="text/css" />
NOTE there seem to be 2 heads begin generated in my HTML. one trying to find all the default rails files and the other which are my own Javascript tags.
Lastly, here's my Javascript which is supposed to actually hide the table
$(document).ready(function() {
// var $divtable = document.getElementById("hidden-content-table");
// $divtable.hide('slow', function() {
// alert('Animation complete.');
// });
var $divtable = $("hidden-content-table");
$divtable.hide('slow', function() {
console.log("HIDDEN");
});
console.log("DOCUMENT READY");
console.log($divtable);
});
Yea, should be var $divtable = $("#hidden-content-table");
精彩评论