web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Javascript on power pa...
Power Pages
Unanswered

Javascript on power pages basic forms only works once

(0) ShareShare
ReportReport
Posted on by 44

Hi Guys,

 

Good day!

 

I've added a little code to hide or show javascript on one of my basic forms in power pages, but the problem here is that it only detect the javascript once.

 

This is the source code I have, the alert function is working and if I did not set any value to my dropdown, it hides the other label but when I change it to yes, it just does not do anything anymore.

 

Anyone can help a fellow newbie out? Thank you.!

 

 var varManuf = $('#cr6bb_navisiondropdown').find("option:selected").text();
 alert(varManuf)
	
 if (varManuf === "Yes") {
 
 $('#cr6bb_purchaselimit').parent().parent().show();
 }
 else {
 $('#cr6bb_purchaselimit').parent().parent().hide();
 }

 

 

Categories:
I have the same question (0)
  • Verified answer
    Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    You need to register an onChange event on the field that is being changed, otherwise it will only run when the form is loaded.

    $( "#your_field_name_here" ).change(function() {
     alert( "Handler for .change() called." );
    });
    
    // note: if the field is boolean (rather than a choice/choices) depending on how you are rendering it you may need to register t slightly differently
  • Xenophonic Profile Picture
    44 on at

    Thanks! this worked

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard