javascript IE 11 problems with getattribute

When using getattribute in JavaScript, I am facing issues with its compatibility in IE 11. Is there an alternative or equivalent method to getattribute that I can use? Below is a snippet of my code:

Code:


var innerFrames = currentRow.all.tags("iframe");

if(innerFrames.length > 0)
{
  var currentFrame = innerFrames[0];
  var frmID = currentFrame.getAttribute("id");
  var ownerID = currentFrame.getAttribute("displayID");
}
var sGroupCaption = (currentFrame.getAttribute("Caption") == null) ? "" : currentFrame.getAttribute("Caption");

if (currentFrame.getAttribute("isEmpty")!= null){ }

    var Type = (currentFrame.getAttribute("displayType") == null) ? "" : currentFrame.getAttribute("displayType");

Please suggest an alternative for getattribute in JavaScript that I can use as a replacement.

Thank you

Answer №1

To access the property directly, you can use one of these methods:

  • currentFrame.propertyName
  • currentFrame["propertyName"]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

retrieve the HTML element using ng-repeat directive in AngularJS

Trying to access the DOM element created in an ng-repeat loop using the provided code, but facing difficulties. <div></div> <ul> <li ng-repeat="data in data""> {{data}} </li> </ul> <script ...

Steps to deactivate a div in React after a single click

When you click the "show" button for the first time, it displays "hello world" correctly. However, if you click on show again, it should not work. How can I make it so that after one click, it does not hide hello world if you click again? I've tried u ...

Is it possible to implement smooth scrolling in HTML without using anchor animation?

Is it feasible to implement a more seamless scrolling experience for a website? I'm referring to the smooth scrolling effect seen in MS Word 2013, but I haven't come across any other instances of this. I've heard that AJAX can make such th ...

Is it possible to improve the appearance of the two similar methods by refactoring one of them?

Is there a better way to handle these two similar methods that are not aesthetically pleasing in terms of code structure? Should we consider refactoring? $("#campaign_title_en").on('textchange', function () { var slug = escapeSlug($(this).val( ...

Trigger a re-render of specific components upon clicking a button in React

Within my server file, there is a function that retrieves a specific set of data based on an ID. app.get('/musicbyid', function(req, res){ var query = req.query.term.toLowerCase(); music.find({ _id: query }, function(err, allMusic){ ...

How can we create a single array in JavaScript based on a single ID from multiple arrays?

Greetings! I have a list of multiple arrays formatted like this: jquery([ { id:2, count:23, numberOfType:34 }, { id:2, count2:53, numberOfType2:34 }, { id:2, count3:53, numberOfType3:34 }, { id:2, count:23, numberOfType:34 }, { ...

Equality and inequality in arrays

Could someone help clarify why these comparisons between different JavaScript arrays result in true? ["hello"] !== ["world"] [42] !== [42] ["apple"] != ["orange"] [7] != [7] ...

Having trouble getting my Jquery Ajax post request to work with JSON data

I am working on syncing data from my Phonegap app back to the server. I have a PHP script set up on the server to handle the incoming data and now I need to figure out how to post values from my App to this script. Currently, I store my data in a SQLite d ...

Generating XML format from JSON using JavaScript

I am looking to create an XML format based on my JSON data, rather than converting it from JSON to XML. Here is an example of the JSON I want to convert to XML: var jsonData = { "Smart Shoes":{ "Product":"Smart Shoes", "Price":24.99, ...

Error: Google Chrome Extension must be used on the Dev Channel or a newer version

I am currently working on developing a Chrome extension for creating URL shortcuts. However, upon trying to add it to the browser, I encountered the following error: There were warnings during the installation of this extension: * 'app.lin ...

The condition is not being recognized after clicking the third button

When the button is clicked for the first time in the code snippet below, all divs except for the red one should fade out. With each subsequent click, the opacity of the next div with a higher stack order should be set to 1. Everything works fine until the ...

The element type provided is not valid: it is expected to be a string (for built-in components) or a class/function (for composite components) but instead it is undefined. This error

I am encountering an error of Element type is invalid: expected a string (for built-in components) or a class/function (for composite components). It seems like I may have forgotten to export my component from the file it was defined in, or there could be ...

"Creating a 3D effect with inset shadow using three.js

I am looking to add inset shadow to my object using three.js, creating a unique effect similar to this image: https://i.sstatic.net/L8Ori.png Imagine something like a ring with engraved text. ...

Expanding form fields using JQuery submit()

I've been attempting to enhance a form by adding additional form fields using JQuery before submitting it. Despite my efforts, I have not been successful with the following Stack Overflow threads: How to add additional fields to form before submit? ...

Developing dynamic buttons with corresponding Bootstrap modals

Established a JavaScript function that dynamically generates and appends buttons, then calling it within a button labeled "+Add New Cube". Upon clicking this button (+Add New Cube), additional buttons are created dynamically. When clicking on one of these ...

How to Exhibit a Line or Value from a CSV File with the Help of JavaScript and AJAX

The data in the CSV file is structured as follows: STATION,DATE,HLY-WIND-AVGSPD,HLY-WIND-VCTDIR USW00013904,01-01T01:00:00,5.6,350 USW00013904,01-01T02:00:00,5.4,346 USW00013904,01-01T03:00:00,5.5,342 USW00013904,01-01T04:00 ...

Error Alert: Issue with UpdatePanel causing parse error - Sys.WebForms.PageRequestManagerParserErrorException

After exploring various resources, I came across this article: Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it An interesting observation is that the issue only occurs on my development machine while two other develope ...

Achieve full expansion or complete collapse in stylesheet through Java code

My goal is to compile multiple XML files into an HTML table and display the results. I utilize the xsl:elemnt command to create individual cells within the tables as shown below: <table> <col span="1" class="firstCol" /> <thead alig ...

When clicked, elevate the element to the top of the window with an offset

Is there a way to click on this button, which is located within an accordion section header, and have it automatically move to the top of the page based on the window size? It seems like it should be a simple task, but sometimes after a long day things ca ...

What is the best way to transfer the $http response value to another function?

I currently have these two functions set up. One function, $scope.submit, handles posting data to the server and capturing the response value. The other function, $scope.addTeams, is responsible for adding teams based on the response from $scope.submit. ...