views:

163

answers:

3

What is the equivalent of jQuery's

closest() function in prototypeJS

and html() function in prototypeJS

Thank you so much.

A: 

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

Reigel
http://api.jquery.com/closest/ which represents closest() is not equivalent to getOffsetParent
Hoque
A: 

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

Gerard Banasig
I was pointing on that one already ;)
Reigel
Using update, I can set the HTML only and how about retrieve?in jQuery, $('#fruits').html() --provide the innerHTML of element#fruit and$('#fruits').html('kiwi,banana and apple') --set the innerHTML
Hoque
A: 

jQuery's html() can set and retrieve html text whereas, prototype has not 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.

Hoque