Webpack causes: jQuery not defined

Recently, I started using Webpack and I was requiring jQuery using ‘require(“jquery”)’ and then I started getting errors in my app like so:

Then I found this piece here which explained that Webpack doesn’t set any global variables, so you have to set them yourself. So I did this:

Happily this solved my issues.

JavaScript boilerplate file


JavaScript Preload Images


Simple HTML slidebar – works on mobile


Get proper placeholder in all browsers with jQuery

So as you know the “placeholder” attribute is supported only in the newest browsers. If you want a placeholder in all browsers you’ll need to write some JavaScript and here is how to do it.

Using my approach you’ll need to set up both the value and the title tag of the input element to the placeholder you want to use. Here is an HTML example:

Here is some css just to make it more pleasing

and here comes jQuery, watch the comments

That’s all you need