I can't figure out why my code for the Google +1 button isn't working as I expected.
http://jsfiddle.net/DerekL/EF8eE/
When you press the +1 button, an alert
should pop up.
Here I got a callback function:
function cb(obj) {
alert(); //alert
console.log(obj); //Then show obj in console
}
But never the callback never gets fired. I followed every single step according to the spec, and the funniest thing is that I got it working before... But now it just does not work at all. Strange!
From the docs (emphasis added),
you can use this HTML5-valid +1 tag (the class attribute must be set to
g-plusone
, and any button attributes must be prefixed withdata-
).
So change
<div class="g-plusone" data-annotation="inline" callback="cb"></div>
to
<div class="g-plusone" data-annotation="inline" data-callback="cb"></div>
Ta-da! http://jsfiddle.net/mattball/FtETf ♫