This works (It prints some text to the screen):
$(document).ready(function() {
var uspTot = 1
var keyTot = 5
$('.field .button').click(function(){
var theSibling = $(this).siblings('div').attr('id');
if (theSibling == 'usp'){
$(this).before('the string is usp')
uspTot++
} else if (theSibling == 'keywords')(
$(this).before('the string is keywords')
)
});
However this doesn't do anything:
$(document).ready(function() {
var uspTot = 1
var keyTot = 5
$('.field .button').click(function(){
var theSibling = $(this).siblings('div').attr('id');
if (theSibling == 'usp'){
$(this).before('the string is usp')
uspTot++
} else if (theSibling == 'keywords')(
$(this).before('the string is keywords')
keyTot++
)
});
The only difference between the two is this bit of code:
keyTot++
I can't understand why this is completely breaking my basic script so I'm hoping someone here can point and say "Oh that's because you've forgotten to XXXX, you daft thing" - Or words to that effect.