cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
z_mike70
Frequent Visitor

How to get a handle on a portal generated button

How do you get a handle on a button that is created from the Advanced Form Metadata in Portal Management?  I want to create a jQuery onClick event and I'm not able to fire the event using the button id I capture when I inspect the button from Chrome Developer Tools.

 

portal.png

 

Here is the button and  jQuery:

portal1.pngportal2.png

1 ACCEPTED SOLUTION

Accepted Solutions

HI @z_mike70 

You need to call the Onclick event slightly different.  I am adding an example below.  Inspect your button either you get the id of the button or use the CSS class name. 

 

ragavanrajan_0-1633923025555.png

 

 

 

Try the following code.  Using the id of the button as an example 

 

 

$(document).ready(function() {
    $('#NextButton').on("click", function() {
       console.log(555, "Ragavan");
       alert("Modal Test")
    });


});

 

 

 Output: 

 

ragavanrajan_2-1633923225411.png

 

 


Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

View solution in original post

4 REPLIES 4
hardikv
Solution Sage
Solution Sage

Hi @z_mike70 

 

May I know, what you want to achieve using button onClick event??

 

Like validate some field value or change the text or something else.

z_mike70
Frequent Visitor

I want to launch a modal window where you can upload attachments.

HI @z_mike70 

You need to call the Onclick event slightly different.  I am adding an example below.  Inspect your button either you get the id of the button or use the CSS class name. 

 

ragavanrajan_0-1633923025555.png

 

 

 

Try the following code.  Using the id of the button as an example 

 

 

$(document).ready(function() {
    $('#NextButton').on("click", function() {
       console.log(555, "Ragavan");
       alert("Modal Test")
    });


});

 

 

 Output: 

 

ragavanrajan_2-1633923225411.png

 

 


Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

View solution in original post

z_mike70
Frequent Visitor

Thanks.  Instead of getting a handle on the button using ID, I used class.  That seems to work.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,868)