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 Apps / Custom Javasrcipt does...
Power Apps
Unanswered

Custom Javasrcipt doesnt want to work on Power Apps portal.

(0) ShareShare
ReportReport
Posted on by 4

Hello guys,

i have this problem with JS on my portal. When using 

 

 

 

 

 

element.innerHTML = '';

 

 

 

 

 

for creating new elements. After saving the code in code editor on portal the part after "element.innerHTML" just cuts off. Here's the code that works on my local: 

 

 

 

 

for (let i = 0; i < itemsCount; i++) {
 let parentElement = document.body;
 let element = document.createElement("div");
 element.setAttribute("class", "item");

 var name = items[i].name;
 var price = items[i].price;
 var desc = items[i].desc;
 var img = items[i].img;
 var qty = items[i].qty;

 element.innerHTML = '<div class="image"><img src=' + img + ' alt="" /></div><div class="description"><span>' + name + '</span><span>TICKET</span></div><div class="quantity"><button class="plus-btn" type="button" name="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16"><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/></svg></button><input type="text" name="name" value="' + qty + '"><button class="minus-btn" type="button" name="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-dash" viewBox="0 0 16 16"><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z"/></svg></button></div><div class="total-price">$' + price + '</div>';

 document.getElementById("parent").append(element);
 }

 

 

 

 

Does anyone know what to do with this or how do I write this code without "" and '' because dataverse doesnt seem to like it.

Screenshot 2022-06-29 at 12.07.02.png
Screenshot 2022-06-29 at 12.06.19.png
Categories:
I have the same question (0)
  • khatuna735 Profile Picture
    2 on at

    Did you find the solution for this topic?

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard