E
E
Evgeny Zhurov2018-02-08 22:55:23
JavaScript
Evgeny Zhurov, 2018-02-08 22:55:23

How to deal with this error in the console?

There is a site that gives such an error in Chrome.
5a7caaf6b19c7457915459.png
On closer examination, claims to this fragment:
5a7cab18eab51445457710.png
It is clear that the point is that the value is undefined, but I just can’t figure out what exactly he doesn’t like and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-02-08
@Zhuroff

self.element has an empty set of elements, so the val method returns undefined instead of the string you expect.
You can fix it by slipping an empty string instead of undefined:
(self.element.val() || '')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question