<%= semantic_form_for :......... do |f| %>
<%= f.inputs do%>
<%= pluralize @size, 'Profitable Routes to test'%>
<p>User id: <%= @id %><p>
....
<title> audio player</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function(){
var u_id = document.getElementById('id')
$("#jquery_jplayer_1").jPlayer({
......
......
......
.......
});
});
//]]>
</script>
I want to pass the User id to javascript, i'm trying to do it with this: var u_id = document.getElementById('id') but it says that u_id is null, who can i pass it? Thanks!
document.getElementById('id')will give you the DOM element that has the ID id, not the actual element ID$("#userId").val()to get the user id.