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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Javascript statement document.getElementById not working

(0) ShareShare
ReportReport
Posted on by

Dear Friends

I have the following JavaScript in HTM Web Resource :

function action()
{
  //var parentActivityId = parent.Xrm.Page.data.entity.attributes.get('activityid');
  var parentActivityId = '8f39813a-2850-e911-a2b6-005056986a49';
  alert("working" + parentActivityId);
  var countTables=$('#Tab').find('table').length;
  //alert("Numbers of Table are" + countTables);
  var table_ID="Tab";
  var table_No=1;

      //var countCheckedRow=$('#Tab1').find("input[type='checkbox']:checked").length;
      //alert("Checked Rows are" + countCheckedRow);
      var table_ID=table_ID+table_No;
      alert("working" + table_ID);

      var grid = document.getElementById("Tab1");
//alert(document.getElementById("Tab1").rows[0].innerHTML);
alert(parent.document.getElementById("Tab1").rows[0].innerHTML);

      //Reference the CheckBoxes in Table.
      var checkBoxes = grid.getElementsByTagName("input");
      var topicID = "";
      alert("check boxes - "+ checkBoxes.length);
     for (var i = 0; i < checkBoxes.length; i++) {
          if (checkBoxes[i].checked) {
     alert("Checked");
alert(document.getElementById("Tab1").rows[i].innerHTML);
             // var row = checkBoxes[i].parentNode.parentNode;
               //topicID = row.cells[1].innerHTML;
                //alert(" " + topicID);


            }
        }

in the above function both of following statement not working:

alert(document.getElementById("Tab1").rows[0].innerHTML);
alert(parent.document.getElementById("Tab1").rows[0].innerHTML);

*This post is locked for comments

I have the same question (0)
  • AndrewLy365lyf Profile Picture
    6 Most Valuable Professional on at

    Will document.getElementById("Tab1").innerHTML return anything?  as opposed to rows[0].

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Anil,

    Where is the table located? Inside the HTML Web Resource. It seems like you are trying to read it both using document and parent.document, so where is it located?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans