Message from JavaScript discussions

June 2019

— Is this even a job


Hi.. jQuery problem
I have 2 p-tags
<p>p 1</p>
<p>p 2</p>


// Output
p 1 p 2

I tried console.log($('p').[0].text())
I had,
jQuery.Deferred exception: (...)[0].text is not a function
TypeError: $(...)[0].text is not a function

— $('p')[0] return DOM Element like <p>p 1</p>

— Btw wut,$('p').[0] ?

— Syntax error

— I learnt $('p') selects all p-tag elements.. I want to access the first one and get it's text

— $('p')[0].text()

— $('p:first').text()

— Yeah.. this works.. and p:eq(0) also works..

— Thanks guys..

— When I write like this the function not running

— Did you define dispatch anywhere?