Timeline for Turn script into a function which extracts the div ID and places it inside
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 18, 2016 at 13:34 | comment | added | sbonkosky | @Quill He's trying to execute the script above every time someone clicks one of the game divs. His original code had the same logic repeated in multiple script tags which added an onclick handler to divs with specific ids. My code allows him to remove all the individual script tags and have the same functionality exist using only 1 onclick handler. | |
May 18, 2016 at 13:34 | vote | accept | JohnDotHR | ||
May 18, 2016 at 13:32 | comment | added | sbonkosky | @JohnDotHR Ok, think its fixed now. | |
May 18, 2016 at 13:31 | history | edited | sbonkosky | CC BY-SA 3.0 |
added 86 characters in body
|
May 18, 2016 at 8:16 | comment | added | JohnDotHR | @Quill It is supposed to replace all the scripts I have in my code with this one. So instead of specifying each script with a div it should autodetect the div. | |
May 18, 2016 at 2:09 | comment | added | Quill | Can you explain how this code is better than what the author already has | |
May 17, 2016 at 22:33 | comment | added | JohnDotHR | Able to fix it?😞 | |
May 17, 2016 at 21:12 | comment | added | JohnDotHR | Still the same error. :( | |
May 17, 2016 at 21:07 | comment | added | sbonkosky | @JohnDotHR haha, np, think I got it, edited my answer. | |
May 17, 2016 at 21:07 | history | edited | sbonkosky | CC BY-SA 3.0 |
added 1 character in body
|
May 17, 2016 at 21:03 | comment | added | JohnDotHR | Actually, yes I see one. Uncaught SyntaxError: Unexpected token ) . But sadly, I think that I'll take a break, it has gotten so bad that I'm unable to look for brackets. I'd be thankful if you could do that for me. Ugh. Thanks a lot for the help, once again. I really appreciate it. | |
May 17, 2016 at 21:00 | comment | added | sbonkosky | @JohnDotHR Are you seeing an error of some sort when you try to include the script that way? Make sure that script tag is placed after the jQuery script tag. | |
May 17, 2016 at 20:44 | comment | added | JohnDotHR | Alright. So the thing I need to do know is basically.. Create a let's say.. game.js and implement it into my HTML <script src="js/game.js"> and I can go ahead and delete the numerous scripts which I've copy pasted? Because I've tried doing that and it isn't working.. Could you please explain what I'm doing wrong atm? The script you wrote looks as it is supposed to work. I'm on a code marathon, my brain is frozen and I'm unallowed to stop, so thanks a bunch for your help. @sbonkosky | |
May 17, 2016 at 20:26 | review | First posts | |||
May 18, 2016 at 2:10 | |||||
May 17, 2016 at 20:26 | history | answered | sbonkosky | CC BY-SA 3.0 |