function bet() {
$('table img').css('cursor', 'pointer');
$('table img').click(function () {
yourBetNumber = $(this).slice(0, -1);
$('#item' + yourBetNumber).clone().appendTo('#yourbet');
$('table').hide();
$('table img').css('cursor', 'pointer');
});
}
I have a table of items displayed, each item is a different image and has a unique ID in the html. What I'm trying to do is enable the user to click on the item they want to bet on and that should be registered as their bet number. I'm not sure the slice part is correct yet, but that's not the point - the function isn't executed at all even though I call it in the code. The debugger also just skips over it entirely when I try to step into the next line (tried with breakpoints etc).
Any idea why this happens and how it could be fixed please?
slice()-thisis a single DOM element, and you seem to expectyourBetNumberto be a string?