Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

JS is not working on Web page.

Posted on by 35

I  have added code in the Custom java Script field of Home web page.

$(document).ready(function(){
alert("Khi");
});

But there is no alert after page load and no error too. 

Can Anyone help me in this.

Thanks in Advance.

*This post is locked for comments

  • Suggested answer
    Manoj  Profile Picture
    Manoj 85 on at
    RE: JS is not working on Web page.

    Hi Every one make sure that , script is written on Content page form  not on Information form then it Works

    Hope it Helps :)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: JS is not working on Web page.

    I am facing a similar issue. I have added my JS in localized content but it is still not running.

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,203 on at
    RE: JS is not working on Web page.

    Thanks for the information Arpit

  • Khushboo Agrawal Profile Picture
    Khushboo Agrawal 35 on at
    RE: JS is not working on Web page.

    Thank you Arpit!!

    After adding JavaScript in Content page, it's working fine.

  • Verified answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: JS is not working on Web page.

    Hi All,

    Javascript won't work on Portal web pages unless you add it to the Localized Content page.

    Localized Content is a new feature enabled to support multi languages in Dynamics 365 Portals.

    Suppose, you have enabled 3 languages in Dynamics 365 Portals, then 3 localized content will appear on each web pages and you will have to add the JavaScript on all the localized content manually in order to make it work for all the languages.

    Hope you understand.

    If find useful, mark the answer verified.

    Cheers

    Arpit

    https://arpitmscrmhunt.blogspot.in

     

  • Suggested answer
    Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: JS is not working on Web page.

    Hi ,

    I checked it further.We can make it work from home page also.In the home page,there is a localized content subgrid,open the home record from there and add your js in javascript section of this page.

    It worked for me.

    Regards,

    Shaminder

  • Khushboo Agrawal Profile Picture
    Khushboo Agrawal 35 on at
    RE: JS is not working on Web page.

    Yes.. It will work fine if you will add same in WebTemplate.  

  • Suggested answer
    Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: JS is not working on Web page.

    Hi Khushboo,

    Checked the same ,strange its not working if we specify it in custom javascript section.

    As a workaround go to Portals>Web Templates>Home

    and add below

    <script>$(function(){ alert('khi'); })  </script>

    Refer this  screenshot to add:7318.alert.PNG

    Here is the alert coming :) 7318.alert.PNG

  • Khushboo Agrawal Profile Picture
    Khushboo Agrawal 35 on at
    RE: JS is not working on Web page.

    Thank you Shaminderpal !

    I am Referncing jquery library in the web resource.

    and added code Jquery code on Home WebPage , But no luck !

  • Suggested answer
    Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: JS is not working on Web page.

    Hi Khusboo,

    As you are using jquery to invoke the onload event.Please check whether you are referncing jquery library in the web resource.

    If still issue persists copy this (function(){

    alert("Khi");

    })()

    It will give you the result

    Regards,

    Shaminder

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans