T
T
Taras Parashchuk2018-03-14 19:02:32
JavaScript
Taras Parashchuk, 2018-03-14 19:02:32

Uncaught TypeError: $(...) is not a function will javascript kill me?

When a table row is clicked, it displays the contents of the first column
alert(this.cells[0].text()); // gives 7
now
typeof(this.cells[0].text()) ; // gives number
now
var lead_id=this.cells[0].text(); // Uncaught TypeError: $(...) is not a function
// Well, WHAT does he need ???

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Denis, 2018-03-14
@taras1978

h_1521045806_2975013_2aa62b3bde.jpeg
Did nothing bother you?

K
Konstantin Kitmanov, 2018-03-14
@k12th

You are deceiving :) There var lead_id=this.cells[0].text();cannot be such an error on the line in principle.
Somewhere you lost jQuery, but where is unclear from the question.
Make a minimally broken example on the codepen and most likely you will find the cause of the error yourself.

A
Anton Shvets, 2018-03-14
@Xuxicheta

cells is an HTMLCollection, i.e. an array-like object containing references to html elements. Not jquery objects. And there is no .text() function for table elements .
To appear, you need to make a jquery object from an element, i.e.$(something.cells[n]).text()

T
Taras Parashchuk, 2018-03-14
@taras1978

Yes, there is jquery . I
read a book for dummies, looked at the docks, but the skis don’t go, it’s some kind of hell ....
Screenshot of the error from the console
5aa94e9cbe17c030307466.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question