I've been puzzled by the following code. Could someone tell me what I'm doing wrong that javascript fails to access the value p ? Thanks !
<% p=progress_for(contest_score) %> # p is non-zero
<script type="text/javascript">
$(function(){
$('#contest_progressbar').progressbar({value: <%=p%>});
<!--value p becomes 0 when rendered by jquery-->
$("#contest_progressbar").css({ 'background': 'LightYellow' });
$("#contest_progressbar > div").css({ 'background': 'Orange' });
$('#contest_progressbar span.text').text(<%=p%>+'%')
<!--value p becomes 0 when rendered by jquery-->
});
</script>
progress: <%=p%> progress bar should be below: # p is the correct value here
<div id='contest_progressbar' style="margin-left:20px; height: 20px;">
<span class="text"></span>
</div>
EDIT: Using straight script tag instead. Same problem though EDIT2: Seems to be a JQuery problem now. See the html in the comment to Bryan's answer