Nazmul
Nazmul

Reputation: 7218

What is the equivalent of jQuery function in Prototypejs?

What is the equivalent of jQuery's

closest() function in prototypeJS?

and html() function in prototypeJS?

Upvotes: 0

Views: 1882

Answers (3)

Nazmul
Nazmul

Reputation: 7218

jQuery's html() can set and retrieve html text whereas, prototype has no such equivalent. Prototype has only update() which can set html of an element. There is no method to retrieve html text like jQuery. However, using innerHTML, we can get and set html text.

jQuery's closest() can be replaced by prototype up() method, as per my understanding.

Thank you so much for all of your support.

Upvotes: 0

Gerard Banasig
Gerard Banasig

Reputation: 1713

I think the .html() function looks like this in prototype

To retrieve the html

$('fruits').innerHTML;
// -> '<ul id="favorite"><li>kiwi</li><li>banana</li><li>apple</li></ul>'

To change the html

$('fruits').update('kiwi, banana and apple');
// -> HTMLElement

http://www.prototypejs.org/api/element/update

Upvotes: 1

Reigel Gallarde
Reigel Gallarde

Reputation: 65274

You might want to read getOffsetParent for closest() and update for html()

Upvotes: 0

Related Questions