- I've been exploring Typescript to improve my coding skills.
- Currently, I have a UI that's functional in jQuery.
- My goal is to transition this UI to Typescript.
- However, I'm facing some challenges as I try to encapsulate everything within the WholeUI() method.
- Unfortunately, I keep encountering errors along the way.
- If anyone has insight on how to troubleshoot this, please share your advice!
Here is a link to a working fiddle: http://jsfiddle.net/46aqscwv/
And here is a link to a broken fiddle: http://jsfiddle.net/Ls1aqLv1/
Error message:
Uncaught SyntaxError: Unexpected token (
at new Function (<anonymous>)
at exec (typescript.js:41)
at HTMLDocument.runScripts (typescript.js:41)
Code snippet causing the error:
function WholeUI() {
$(document).ready(function() {
$('ul.tabs li').click(function() {
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#" + tab_id).addClass('current');
})