I'm currently facing a problem where my on click function doesnt trigger in safari but does work in other browsers.
I have two span elements which should work as buttons
HTML:
<span class="firstLink" onclick=""><a>addClick + </a></span>
<span class="secondLink" onclick=""><a>removeClick -</a></span>
jQuery:
$('body').on('click', 'span.firstLink', function() {
currentClick++;
clickPerformer(currentClick);
});
$('body').on('click', 'span.secondLink', function() {
currentClick--;
clickPerformer(currentClick);
});
Here's clickPerformer function:
function clickPerformer(i) {
var obj = {
show: function() {
alert(i);
}
};
obj.show();
}
Previous code is all inside
$( function() {
// here
});
When I call clickPerformer when page loads, it works. But not when I click on those two 'buttons'.
When I put
alert('blah blah...')
inside
$().on('click')
it wont work aswell.
Any ideas what might cause the problem? All help appreciated!