I have create a function so that it would load the function whenever call that function through the button. But it works only when I refresh the page but not working when I hit the Swap button.
Here is the link http://www.onlinedemowebsite.com/design/swatch/drag-and-drop/try3.html
Can anyone help me to solve the problem.
Thanks
You have onclick=”shuffle()” on the swap button and that function is not defined in the global scope which the event will be fired within. Either move the function to the window scope, or create the DOM-node and attach a real event to it instead of using document.writeln
Also, the shuffle function use document.writeln, an example would be to revise it and do something like this instead:
Edited:
change your shuffle function to look like this:
then change the part where you create the container (in print_2d_string_array)