Forum Discussion

Vasily_Zaytsev's avatar
Vasily_Zaytsev
Iron Contributor
Aug 17, 2021

How fire click event once on Project Server 2019?

I have this js:

var attachSaveEvent = setInterval(function() { if ($("#Ribbon\.ContextualTabs\.ProjectDrilldown\.Tasks\.Update\.PublishProject-Large").length == 1) { $('#Ribbon\.ContextualTabs\.ProjectDrilldown\.Tasks\.Update\.PublishProject-Large').click(function() { var res_pwa_big = PWAGreetingToDb(_spPageContextInfo.userId, GetParameterValues('ProjUid')); if (res_pwa_big == 'error') { console.log('Error:on:PublishProject-Large:click'); } }); } if ($("#Ribbon\.ContextualTabs\.ProjectDrilldown\.Tasks\.Update\.PublishProject-Small").length == 1) { $('#Ribbon\.ContextualTabs\.ProjectDrilldown\.Tasks\.Update\.PublishProject-Small').click(function() { { var res_pwa_small = PWAGreetingToDb(_spPageContextInfo.userId, GetParameterValues('ProjUid')); if (res_pwa_small == 'error') { console.log('Error:on:PublishProject-Small:click'); } }); } },500); }

This fire several times (2,3,5,...). How can it fire once on Button click? If I use clearInterval(attachSaveEvent), I can't fire second, third ... click.

BR, Vasily

No RepliesBe the first to reply

Resources