Helow everybody,
My problem is described on title there is the code:
<div class="g-plusone" data-size="standard" data-callback="GplusClick" data-annotation="none" data-href="http://URL" id="ID"></div> <script type="text/javascript"> function GplusClick(jsonParam){ if(jsonParam.state=='on') { alert(ids); } } </script>
Fine I want just get the Id of g-plusone button.
Thank you
Your question is extremely vague, but if i understand you correctly, you just want to get the ID of the clicks Google Plus element.
Something like this should work:
var GplusClick = function(element) { alert(element.id); }
<div class="g-plusone" data-size="standard" data-annotation="none" data-href="http://URL" id="dynamicId" onclick="GplusClick(this)">+1</div> <div class="g-plusone" data-size="standard" data-annotation="none" data-href="http://URL" id="anotherDynamicId" onclick="GplusClick(this)">+1</div>
if you are using jquery, this should do what you need
<div class="g-plusone" data-size="standard" data-callback="GplusClick" data-annotation="none" data-href="http://URL" id="ID"></div>
<script type="text/javascript">
$('.g-plusone').click(function(){
alert(this.id);
})
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.