Question: ```
$('button').click(function(){ console.log('works'); });

```

This outputs 'works' when I click the required button. 

But if I pack the same code in a function and call it with parentheses attached to it(as you usually invoke a function), as in 

```
function worker(){ console.log('works'); }
$('button').click(worker());

```

*worker* gets fired without any click on *button*. But if I avoid the parentheses, as in 

```
function worker(){ console.log('works'); }
$('button').click(worker);

```

I'm getting the desired functionality. Why the *click* handler behaves this way?

Answer: 
I faced the same issue. I did the following steps, which solved the problem. Before flashing a new firmware, make sure your chip is fully erased. You may use the command below where "serial-port-of-ESP8266" may vary:

```
esptool.py --port <serial-port-of-ESP8266> erase_flash

```

Then flash the firmware to the chip using the same technique you use for flashing nodeMCU 0.9.6. You can refer the command below, which is what I used for flashing.

```
esptool.py --port /dev/ttyACM0 write_flash -fm qio 0x00000 nodemcu-master-8-modules-2016-12-16-09-52-59-float.bin

```
Tried to get it running but no way for my "WeMos Mini D1" using this line 

`esptool.py --port /dev/ttyUSB0 write_flash -fm dio -fs 32m 0x00000 my-nodemcu.bin 0x3fc000 esp_init_data_default.bin --verify`

Answer is:

```
Wrote 454656 bytes at 0x0 in 39.2 seconds (92.9 kbit/s) 
WARNING: Unlikely to work as data goes beyond end of flash. Hint: Use --flash_size 
Writing 36864 @ 0x3fc000... 16384 (44 %)
A fatal error occurred: Write failure, status: 36'

```

The image from the cloud build has only 6 options, so its unlikeley that the image is too large.