Ruby on Rails Wednesday, February 3, 2016

Colin Law wrote in post #1181132:
> On 3 February 2016 at 07:46, Naveed Alam <lists@ruby-forum.com> 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 Developer > 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,

<script>
jQuery(function() {
jQuery("#total_mark").keyup(function() {
alert("key pressed");
var t = jQuery("#total_mark").val();
var o = jQuery("#ob_marks").val();
jQuery("#percentage").val(o * 100 / t);
})
});
</script>

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/64202b4abaa8e19dc183894813ccc348%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment