{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/279","repository_url":"https://api.github.com/repos/ga-wdi-boston/game-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/279/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/279/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/279/events","html_url":"https://github.com/ga-wdi-boston/game-project/issues/279","id":176284516,"number":279,"title":"\"data.option is not a function\" in bootstrap.js errors when using a modal element","user":{"login":"bullhead242","id":21027137,"avatar_url":"https://avatars.githubusercontent.com/u/21027137?v=3","gravatar_id":"","url":"https://api.github.com/users/bullhead242","html_url":"https://github.com/bullhead242","followers_url":"https://api.github.com/users/bullhead242/followers","following_url":"https://api.github.com/users/bullhead242/following{/other_user}","gists_url":"https://api.github.com/users/bullhead242/gists{/gist_id}","starred_url":"https://api.github.com/users/bullhead242/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bullhead242/subscriptions","organizations_url":"https://api.github.com/users/bullhead242/orgs","repos_url":"https://api.github.com/users/bullhead242/repos","events_url":"https://api.github.com/users/bullhead242/events{/privacy}","received_events_url":"https://api.github.com/users/bullhead242/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-12T02:50:57Z","updated_at":"2016-09-20T21:03:09Z","closed_at":"2016-09-20T21:03:09Z","body":" `grunt nag ` output returns all style errors, but no errors regarding extra or missing syntax errors. \r\n\r\nTo assign initial actions to a click on a game cell, i have created the `whenClicked` function. \r\n```\r\nfunction whenClicked(event) {\r\n  const cellIndex = parseInt(event.target.dataset.index);\r\n  if (app.game.cells[cellIndex] === \"\"){\r\n    $.fn.bootstrapBtn = bootstrapButton;\r\n    switchTurn();\r\n    return(cellIndex);\r\n  } else {\r\n    alert('NOPE');\r\n  }\r\n}\r\n```\r\nThis contains a test for a move's validity, a condition should the move be invalid, and causes the next player's turn to begin which uses a function i have called `switchTurn`. \r\n```\r\nconst switchTurn = function() {\r\n  if (player === 'X') {\r\n    player = 'O';\r\n  }else{\r\n    player = 'X';\r\n    $(\"#messages\").modal(\"Hey it's player\" + player + \"'s turn!'\" );\r\n  }\r\n};\r\n```\r\n\r\nPart the last part of the function contains a uses jQuery to find an DOM element with the ID of `message`, and uses the `.modal` method to add text to the element, which has been used in a similar way to display the email of the user, and the number of games played after logging in. \r\n\r\nThe page loads, a user can be created or logged in and a new game begun without issue. The issue occurs after a click occurs inside the game board and the `whenClicked` function runs, which contains the `switchTurn` callback. The error in the browser is as follows:\r\n\r\n```\r\nbootstrap.js:1215 Uncaught TypeError: data[option] is not a function\r\n(anonymous function) @ bootstrap.js:1215<br>\r\neach @ jquery.js:365\r\neach @ jquery.js:137\r\nPlugin @ bootstrap.js:1209\r\nswitchTurn @ events.js:51\r\nwhenClicked @ events.js:58\r\ndispatch @ jquery.js:4737\r\nelemData.handle @ jquery.js:4549\r\n```\r\n\r\nI changed the `.modal` and moved the html related the element around a bit to no avail. A debugger run inside the `switchTurn` function where the `.modal` is called directs me to a section of `jquery.js` and `bootstrap.js`. \r\n\r\nWhen searching Google and StackOverflow for the error message, `data[option] is not a function`, the [first](http://stackoverflow.com/questions/8586306/bootstrap-modal-is-not-a-function) result pulls up some code with very vague usage instructions which I implemented to no avail. This post also referenced a potential conflict between Bootstrap and jQuery which led me to Google \"bootstrap conflict with jquery\" and came back with [another result](http://stackoverflow.com/questions/23428285/bootstrap-and-jqueryui-conflict) which mentioned using a `tooltip` function which I have not added or called. \r\n\r\nIt seems I have stumbled into a conflict with the existing libraries, and I am not certain what steps I can take to remedy them, as the listed sections of `bootstrap.js` and `jquery.js` look to be above my proverbial pay grade. \r\n\r\nThank you for taking the time. \r\nPete"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/comments/248433474","html_url":"https://github.com/ga-wdi-boston/game-project/issues/279#issuecomment-248433474","issue_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/279","id":248433474,"user":{"login":"bullhead242","id":21027137,"avatar_url":"https://avatars.githubusercontent.com/u/21027137?v=3","gravatar_id":"","url":"https://api.github.com/users/bullhead242","html_url":"https://github.com/bullhead242","followers_url":"https://api.github.com/users/bullhead242/followers","following_url":"https://api.github.com/users/bullhead242/following{/other_user}","gists_url":"https://api.github.com/users/bullhead242/gists{/gist_id}","starred_url":"https://api.github.com/users/bullhead242/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bullhead242/subscriptions","organizations_url":"https://api.github.com/users/bullhead242/orgs","repos_url":"https://api.github.com/users/bullhead242/repos","events_url":"https://api.github.com/users/bullhead242/events{/privacy}","received_events_url":"https://api.github.com/users/bullhead242/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T21:03:09Z","updated_at":"2016-09-20T21:03:09Z","body":"Issue resolved/ rendered irrelevant by adding `.text` to a new element available as a new sidebar element. \r\n\r\nI suspect issue was with the command to open the modal element instead of the element or any of the conent. "}}
{"actor":{"display_login":"bullhead242"}}