Ashok.N
Ashok.N

Reputation: 1391

Jquery append() function is failing in IE11

I am Jquery 1.10.2 version. My requirement is to add an xml node at specific node of the already existing xml. For that I am using Jquery append() function. It's working fine in Chrome, Firefox and IE Edge, but failing in IE11.

Getting the following error in IE11:

Object doesn't support this property or method

The following is the code

var effectiveDate = document.getElementById("brokerEffDate").value;
var groupSummaryResponse = soapGetGroupSummary.responseXml.cloneNode(true);


 var userProvidedEffDateNode = "<userProvidedEffDate>"+effectiveDate+"</userProvidedEffDate>";

  if (groupSummaryResponse != null){
            $(groupSummaryResponse).find('divisions').append(userProvidedEffDateNode);
            $(groupSummaryResponse).find('division').each(function(){

                if ($(this).children().get(6).innerHTML == ''){
                    $(this).find('GroupExpDt').text('12/31/9999')
                }

            });
 }

What changes do I need to make it work in IE11?

Node.appendChild is also not working in my case.

Upvotes: 0

Views: 192

Answers (1)

Soumya Das
Soumya Das

Reputation: 99

Both should work but IE sometime blocks some content if it is running from localhost.

<HTML>
<HEAD>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</HEAD>
<BODY>

<input type="text" id="brokerEffDate" value="testing" />

<div id="divData1">test div1 </div>

<div id="divData2">test div2 </div>


<script>
var effectiveDate = document.getElementById("brokerEffDate").value;

var divData2 = document.getElementById("divData2");

var userProvidedEffDateNode = "<div>" + effectiveDate + "</div>";
var ele = document.createElement("div");
ele.innerHTML = effectiveDate;

 $("#divData1").append(userProvidedEffDateNode);
 divData2.appendChild(ele);

</script>
</BODY>
</HTML>

Allow the blocked content Allow the blocked content

Result. Mostly you will face this issue only when you are running from localhost Result

Upvotes: 1

Related Questions