Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to write Javascript function for iruby #133

Open
Shekharrajak opened this Issue Jul 12, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@Shekharrajak
Copy link
Member

commented Jul 12, 2017

I am trying to generate HTML and Javaascript code for the data table. When I use

<script type='text/javascript'>
$(document).ready(function() {

  $('#id').DataTable(
    {..}
  );
});
</script>

then it works fine for the Web application . But it doesn't work for IRuby notebook.
The IRuby notebook I tried is this .
How can we replace $ , ready so that it can work on both ?

@Shekharrajak

This comment has been minimized.

Copy link
Member Author

commented Jul 12, 2017

The error I see is this :

Javascript error adding output!
TypeError: $(...).DataTable is not a function
See your browser Javascript console for more details.
@Shekharrajak

This comment has been minimized.

Copy link
Member Author

commented Jul 13, 2017

Actually I want to replace JQuery code and write in Javascript only so that it can work . $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.

I fixed the similar problem by removing the var onload = window.onload; and replacing (function() { with$(function() { and ending it with});not})()` . The code is here .

@v0dro

This comment has been minimized.

Copy link
Member

commented Jul 26, 2017

@mrkn ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.