Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

Button click not firing Javascript

(0) ShareShare
ReportReport
Posted on by 179

I’m having problems trying to call javascript from a portal page. Ultimately the button click will run an Azure function.

 

But for now I’ve stripped this right back to basics with a very simple example to display a message when a button is clicked, but nothing happens. I’m missing something obvious I’m sure?

 

The javascript resides in the Custom Javascript section of the Advanced option of the web page

 

 

paulsnolan_0-1614012212615.png

 

 

And the HTML for the button is in the Web Template used by the page

 

paulsnolan_1-1614012212621.png

 

 

And the button appears on the page

 

paulsnolan_2-1614012212623.png

Thanks in advance

 

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Button click not firing Javascript

    Yeah, "sync configuration" and "clear cache" would be sort of the same thing.

    To access the clear cache under the _services/about page, you need to make sure your Contact/User record has the Administrator Web Role associated.

     

    Anyways, I am glad you got it working, can you please mark the solution in case other people are facing the same issue ?

  • Verified answer
    paulsnolan Profile Picture
    179 on at
    Re: Button click not firing Javascript

    Hi Fubar, got simple click working, my bad, syntax for click was missing () after the function, school boy error! Used simple non JQuery method. Now onto my real purpose which is calling Azure function from button click. Will return to the original problem re JQuery format once got Azure call working, just trying to prove some functionality which we need. Thank you for your and Oliver's help.

  • paulsnolan Profile Picture
    179 on at
    Re: Button click not firing Javascript

    Thanks Oliver, yes I can do that no problem, I didn't realize this was what you meant by clear cache, I was trying to use "portal_path/_services/about". Interestingly when one of my colleagues with admin rights navigates to this URL we only see a page with Portals "some guid" and nothing else

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Button click not firing Javascript

    Another way to clear the cache is using the "Sync Configuration" option from Portal Studio. Go to make.powerapps.com --> apps --> select the Portal App and click Edit

    This will open the Portal Studio, you should be able to see a button for "Sync Config" there.

  • paulsnolan Profile Picture
    179 on at
    Re: Button click not firing Javascript

    Hi Oliver

    Thanks for the reply. Yes the change is under the Localized/Content Web Page/Advanced/Custom Javascript. However, the cache hasn't been cleared as I don't have admin rights. Once this is sorted I will let you know the outcome.

  • Fubar Profile Picture
    8,023 Super User 2025 Season 1 on at
    Re: Button click not firing Javascript

    As per Oliver's comment, and also make sure that the script has refreshed in the cache (you need to reset the portal cache after each JS update etc).  I think what you have should work, but...

     

    Possibly try dropping the "window." and leave just alert().  You could also try the other method for the onclick (and also the non Jquery with just an onclick in the input tag to get something working)

    $("#inputid").on("click", function(){
     alert("Was clicked.");
    }); 

     

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Button click not firing Javascript

    Hi @paulsnolan, in Power Apps Portals, we have two Web Pages, a parent/root Web page, and a localized/content Web Page.

    Can you confirm if your JS code is under the Localized/Content Web Page? That's where it should be placed.

    Also, have you cleared the cache? 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35