3 ms·
Nice. So where is my $.text(), $.css(), $.html(), $.val(), $.first(), $closest(), etc.?
by joesb 11y ago
Nice. So where is my $.text(), $.css(), $.html(), $.val(), $.first(), $closest(), etc.?
- izolate 11y agoWith bling.js: .text: $('.selector')[0].textContent .css $('.selector')[0].style .html: $('.selector')[0].innerHTML .val: $('.selector')[0].value .first: $('.selector')[0] .closest: n/a
- joesb 11y agojQuery's $.text/html() set the text of all matched nodes, not just the first one. I can use key-value object to assign multiple css property, and it can set the style on all matched nodes. If there are no matched elements, Bling's $()[0].xxx = value" will raise exception.
- izolate 11y agoThat's the thing, Bling.js also makes it easy to set the text/css on all nodes: $('.foo').forEach(el => el.textContent = 'bar') $('.foo').forEach(el => el.style.top = '0px')