0

Hi i have below fiddle which is working fine!!

Working Fiddle

But i have copied same in below fiddle. But it is not working. I am really worried about this doubt. Please help me by explain this. Then only i can sleep properly.

Not Working Fiddle

HTML

<input type="submit" id="byBtn" value="Change" onclick="change()" />

Javascript

function change() {
  alert("Clicked");
}
Power Star
  • 1,724
  • 2
  • 13
  • 25

1 Answers1

0

This is because your javascript load type has been set to OnLoad To resolve the issue,

1) Click on JavaScript settings button near to your function [right hand side of function]

2) Select mootools 1.4.5 version in framework and extension

3) This is important. In load type select No Wrap - In Head option

4) Click on run.

Now your function will work.

Why it is executing now because we had made the load type as No Wrap in Head and changed it from onLoad. Because of this your function is global now and it can be referenced. If it is OnLoad then it can be referenced within the function call only.

I Hope this helps. :)

Amar Gadekar
  • 387
  • 4
  • 11