Skip to content
New issue

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

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

Already on GitHub? # to your account

How to write Javascript function for iruby #133

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

How to write Javascript function for iruby #133

Shekharrajak opened this issue Jul 12, 2017 · 3 comments
Labels

Comments

@Shekharrajak
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member

v0dro commented Jul 26, 2017

@mrkn ping!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants