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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Javascript code works ...
Power Pages
Answered

Javascript code works in console but not in js file for portal webpage

(0) ShareShare
ReportReport
Posted on by 134

Hi everyone,

I have a webpage recording invoices details in power apps portal.

Quantity value is displayed as "1.00000", so I tried deleting extra 0 after decimal point through the below code.

Audreyma_0-1626161877912.png

 

When putting the code in chrome console, it works.  But including it in webpage's custom Javascript, it didn't.

document. ready was included as well, not sure about the reason.

$(function() {
 $("#invoicedetails td:contains('.00000')").each(function(){
 var txt = $(this).text();
 $(this).html(
 txt.replace(/\.00000/g,'')
 );
 });
});

Any idea, please kindly share with me.  Thanks in advance!

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Audreyma,

     

    If you are using an entity list then probably the data has not been loaded yet when your code executes (on document.ready). You could try adding your javascript to the loaded event of the entity grid, either in the custom javascript of the page or the grid itself. Something like:

     

    $(document).ready(function (){ 
     $(".entitylist.entity-grid").on("loaded", function () {
     $(this).find("td:contains('.00000')").each(function(){
     var txt = $(this).text();
     $(this).html(txt.replace(/\.00000/g, ''));
     })
     })
    });

     

  • Audrey Ma Profile Picture
    134 on at

    Hi @Anonymous 

    Thank you for your advice.

     

    The table existed in an entity form.  I changed the code a little bit and it worked.

    Really appreciate your help!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
sannavajjala87 Profile Picture

sannavajjala87 42 Super User 2026 Season 1

#2
Valantis Profile Picture

Valantis 35

#3
Fubar Profile Picture

Fubar 23 Super User 2026 Season 1

Last 30 days Overall leaderboard