Hello,
I want to calculate percentage marks of students using jquery, for this
I tried the below code but its not working. I am very beginner in ruby
on rails.
Hello,
I want to calculate percentage marks of students using jquery, for this
I tried the below code but its not working. I am very beginner in ruby
on rails.
On 2 February 2016 at 10:02, Naveed A. [email protected] wrote:
<div class="extender"></div>
“percentage” %>
});
A simple way to debug your code is to use the javascript alert
function to display values as they are calculated so, for example, at
the start of the function you could insert
alert(“In function”);
then after the line var t = …
alert(t)
to check that the value of t is being calculated correctly. Then you
can work out where it is going wrong. Also, in firefox, open the
console window (Tools > Web D. > Web Console) and reload the
page and it will tell you if there are any errors in the javascript.
Colin
The alert is not working too. and showing no error, looks that the
script is not running at all.
below is the complete code.
<% unless flash[:notice].nil? %>
<%= flash[:notice] %>
<% form_for :student_previous_details do |a| %>
<%#= error_messages_for ‘employee_bank_details’ %>
<span class="span-sub-heading"><%= t('previous_educational_details')
%>
<div class="extender"></div>
</div>
<div class="save-proceed-button">
<%= link_to "► #{t('skip')}", {:controller => "student", :action
=> “admission4”, :id => @student.id },:class=>‘user_button’ %>
<%= submit_tag "► #{t('save_and_proceed')}", :disable_with => "►
#{t(‘please_wait’)}" %>
</div>
</div>
<% end %>
<li><div class="name"><%= p.subject %></div>
<div class="themed_text val"><span>:</span><%= p.mark
%>
:update => "added_subjects"%></div>
</li>
<% end %>
<% end %>
</ul>
<%= link_to_remote "#{t('add_subject')}",
:url=>{:controller=>“student”,:action=>“previous_subject”,
:id=>@student.id},:loading=>"$(‘loader’).show();"
,:loaded=>"$(‘loader’).hide();"%>
<%= image_tag(“loader.gif”, :align => “absmiddle”, :border => 0, :id
=> “loader”, :style =>“display: none;” ) %>
</div>
Checked with validator and it showed no error in this script.
The alert is not working too. and showing no error, looks that the
script is not running at all.
below is the complete code.
<% unless flash[:notice].nil? %>
<%= flash[:notice] %>
<% form_for :student_previous_details do |a| %>
<%#= error_messages_for ‘employee_bank_details’ %>
<span class="span-sub-heading"><%= t('previous_educational_details')
%>
<div class="extender"></div>
</div>
<div class="save-proceed-button">
<%= link_to "► #{t('skip')}", {:controller => "student", :action
=> “admission4”, :id => @student.id },:class=>‘user_button’ %>
<%= submit_tag "► #{t('save_and_proceed')}", :disable_with => "►
#{t(‘please_wait’)}" %>
</div>
</div>
<% end %>
<li><div class="name"><%= p.subject %></div>
<div class="themed_text val"><span>:</span><%= p.mark
%>
:update => "added_subjects"%></div>
</li>
<% end %>
<% end %>
</ul>
<%= link_to_remote "#{t('add_subject')}",
:url=>{:controller=>“student”,:action=>“previous_subject”,
:id=>@student.id},:loading=>"$(‘loader’).show();"
,:loaded=>"$(‘loader’).hide();"%>
<%= image_tag(“loader.gif”, :align => “absmiddle”, :border => 0, :id
=> “loader”, :style =>“display: none;” ) %>
</div>
On 2 February 2016 at 11:26, Naveed A. [email protected] wrote:
The alert is not working too. and showing no error, looks that the
script is not running at all.
Please quote the previous message when replying, this is a mailing
list not a forum (though you may be accessing it via a forum like
interface). It is easier to follow the thread if you quote the
previous message and insert your reply at appropriate point(s) in the
message. Thanks.
Have a look at the html source (Tools > Web D. > Page Source)
and check the the fields have the correct id. If that looks ok then
copy the complete page source and paste it into the html validator at
The W3C Markup Validation Service to check that it is valid.
Colin
On 3 February 2016 at 07:46, Naveed A. [email protected] wrote:
Checked with validator and it showed no error in this script.
The alert is not working too. and showing no error, looks that the
script is not running at all.below is the complete code.
[snipped the erb source code]
Please read my message again (if you had quoted the bit you were
replying to you would have seen this is not all that I asked for, I
also asked:
Have a look at the html source (Tools > Web D. > Page Source)
and check the the fields have the correct id.
Also maybe a good idea to copy/paste the relevant section here.
Looking at the code I see that you have put the javascript inside a
div which is a bit unusual, but I don’t think it matters. Difficult
to see why you have put it there though.
Colin
Colin L. wrote in post #1181132:
On 3 February 2016 at 07:46, Naveed A. [email protected] wrote:
Checked with validator and it showed no error in this script.
The alert is not working too. and showing no error, looks that the
script is not running at all.below is the complete code.
[snipped the erb source code]
Please read my message again (if you had quoted the bit you were
replying to you would have seen this is not all that I asked for, I
also asked:Have a look at the html source (Tools > Web D. > Page Source)
and check the the fields have the correct id.Also maybe a good idea to copy/paste the relevant section here.
Looking at the code I see that you have put the javascript inside a
div which is a bit unusual, but I don’t think it matters. Difficult
to see why you have put it there though.Colin
Replacing $ with jQuery worked for me,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs