Prototype Element.update multiple objects

I am trying to build a table using the Prototype New Element function. I was having problems with Firefox when I updated thead with full content: all elements and content. Firefox separates tags and displays only content.

In any case, I decided to build every single element, and then add it to thead using the function Element.update(). But I did not find a way to add multiple objects using this function.

The th elements are as follows:

var thead_amount = new Element('th', {
    'id': 'amount'
}).update('amount');

This works great:

new Element('thead').update(thead_amount);

This outputs the same as above:

new Element('thead').update(thead_amount, thead_pdf, thead_tags, thead_date, thead_options);

It outputs [object HTMLTableCellElement][object HTMLTableCellElement][object HTMLTableCellElement][object HTMLTableCellElement][object HTMLTableCellElement]

new Element('thead').update(thead_amount + thead_pdf + thead_tags + thead_date + thead_options);

How to add multiple objects using the Prototype function update()?

Thanks!

+1
source share
1

Edit

, "TH" "THEAD". ! THEADAD TR. TR TH, THEAD, TD.

: tbody, thead tfoot tr . td th , .

, Element.update() , HTML javascript, toString (, Element). , "+", , , . toString :

new Element('thead').update(thead_amount.toString()
  + thead_pdf.toString() 
  + thead_tags.toString() 
  + thead_date.toString() 
  + thead_options.toString());

script.aculo.us ( Prototype), Builder Element. , . :

var table = Builder.node('table', {
  width: '100%',
  cellpadding: '2',
  cellspacing: '0',
  border: '0'
});

var tbody = Builder.node('tbody'),
    tr = Builder.node('tr', { className: 'header' }),
    td = Builder.node('td', [Builder.node('strong', 'Category')]);

tr.appendChild(td);
tbody.appendChild(tr);
table.appendChild(tbody);

$('divCat').appendChild(table);

http://wiki.github.com/madrobby/scriptaculous/builder.

+1

Source: https://habr.com/ru/post/1713157/


All Articles