'How can I enable IntelliSense for JavaScript inside HTML?

I want to use VS Code to try out the examples of a JavaScript book, but there's no IntelliSense, or at least I don't know how to activate it.

In Visual Studio this feature works out of the box :

enter image description here

But in VS Code, all I got is a message saying "No suggestions."

enter image description here

What do I need to do to enable IntelliSense in VS Code?



Solution 1:[1]

Currently Unsupported

JS intellisense doesnt work in HTML script tag - VSCode GitHub Issues #4369

Smart Javascript suggestions inside HTML files no loger working after Visual Studio Code update - StackOverflow

Solution 2:[2]

Starting with the November 2016 (version 1.8) release, Visual Studio Code now fully supports IntelliSense for JavaScript in HTML.

Note that the language support doesn't follow script includes, it only knows about definitions made in the same file.

Solution 3:[3]

It worked for me, when the file had a .js extension. I didn't get any intellisense when I pasted it into .html file between script tags.

Edit To Add: You can also change the Language Mode by clicking 'HTML' in the bottom of the VS Code window and change it to 'JavaScript'.

Solution 4:[4]

It is supported!

Intellisense and syntax highlighting start working after replacing

<script>something()</script>

with

<script type="text/javascript">something()</script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Jakub Synowiec
Solution 3
Solution 4