rabbitfeetz rabbitfeetz - 1 year ago 103
jQuery Question

How do I use jquery's .html( ) in opal-jquery?

I've read all of the documentation I can find and it is a bit spotty. Can someone tell me how to use jquery's

method in the
ruby -> jquery
bridge opal-jquery?
Also any advice for how I would go about figuring out implemented methods in a sparsely documented gem in the future would definitely be appreciated.

Answer Source

jQuery's .html() method in opal-jquery is mapped as Element#html and Element#html=.

The latter is definitively more like Ruby and is obviously there to set HTML content.

For convenience though you can still use #html as both a setter (with an argument) or a getter (no arguments).

This is where .html() is aliased as #html=:


This is where #html is defined: