3 ms·
With bling.js: .text: $('.selector')[0].textContent .css $('.selector')[0].style .html: $('.selector')[0].innerHTML .val: $('.selector')[0].val
by izolate 11y ago
With 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')