What is the best method for aligning a div in Internet Explorer 9 with the help of JavaScript?

The code in this Javascript function is not responding as expected in IE9, although it functions correctly in Chrome.

function adjustDivPosition(divID,leftPos,topPos)
{   
  document.getElementById(divID).style.left = leftPos;
  document.getElementById(divID).style.top = topPos;
}

Answer №1

Give this a shot and verify:

document.getElementById(nm).style.left = l+"px";
document.getElementById(nm).style.top = t+"px";

Assuming that both l and t are numbers.

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

Activate the sliding toggle feature on click for all div elements

Whenever a specific li element is clicked, I aim to open its corresponding div element. This is the code snippet I currently have: <ul class="no-padding pro-list"> <li><a href="#" class="pro-1 pro">A</a> <div class= ...

Add information to the database and display the updated data without the need to manually refresh the page by calling the data directly after it has been

How can I insert data into a database using an AJAX call ($.ajax()), generate a tracking code using PHP, and insert it along with other data into the database? And then, how can I display this tracking code to the user without refreshing the page? With r ...

What is the best way to navigate back to the previous state in reactjs?

I have implemented a sidebar component with its initial state set to false in order to hide the block until a user interacts with the hamburger icon. Once clicked, the state changes to true and displays the sidebar menu. However, I am facing an issue whe ...

Is it possible to dynamically set the body id in React?

I'm currently working on implementing a dark mode feature in my app. The plan is to insert the following code into the root element: <div id="dark"> Afterwards, add the following CSS: #dark { background-color: #1A1A2E; } Subseq ...

Changing the filepath for the build script in the package.json file for a NextJS project when deploying to Heroku

My project is currently structured as Root: Folder 1/ Folder 2/ Folder 3/ .. Frontend/ The front end folder contains my Nextjs project, package.json file, and everything else. However, Heroku requires the content in the Frontend/ folder to be in the root ...

The process of automating CSS testing

We are currently in the process of developing a website using SharePoint 2010 for a client who already has an existing PHP website. We are working to ensure that the front end of the new site matches the styling of the client's current PHP site, speci ...

Secure TypeScript Omit Utility for Ensuring Type Safety

I need to create a custom implementation of Lodash's _.omit function using plain TypeScript. The goal is for the omit function to return an object with specific properties removed, which are specified as parameters after the initial object parameter. ...

Pause/advance video by clicking manually

How can I create a functionality where a video ends when a user clicks on a skip button to allow them to skip the video? I have successfully used the following code, which triggers an action when the video reaches its end. HTML <video autoplay> ...

Tips for minimizing white space in list groups for Bootstrap 4

Is there a way to decrease the spacing between list items in a list group? I attempted to adjust the margin using CSS, but encountered an issue with the last list item not formatting correctly. CSS .list-group-item{ margin-bottom: -6px; ...

How can an ASP.net Razor application utilize Bootstrap, CSS, or JS to quickly rearrange table columns by moving them left and right? Is there a simple method to reorder columns dynamically in real-time?

Looking for a way to dynamically move columns in an HTML table when the user clicks on a left/right caret within the column header. It seems like a challenging task, but I'm determined to make it work! Any tips or suggestions on how to successfully im ...

"Extending Material-UI: Utilizing Multiple Snackbar Components

I've been struggling to display multiple warnings using Snackbar from the Material UI library in my React project. I haven't found any examples with React, only Vue. Can anyone help me with this? Here is the code that I have tried so far: https: ...

Encountering an issue with receiving "undefined" values while utilizing WordPress post metadata in AngularJS

Utilizing the Wordpress REST API v2 to fetch data from my functional Wordpress website to an AngularJS application. Everything is functioning properly, however when I attempt to access post meta such as "_ait-item_item-data", it returns an error stating "u ...

Is it possible to utilize JavaScript for displaying a continuous stream of images?

In this scenario, you are tasked with working with an image API and need to send a POST request to retrieve an image stream for display on the rest of your webpage. While I am able to use jQuery to make an ajax request to the service upon page load, I am ...

What is the best way to make a div expand to the full width of the screen while still being contained within its parent div?

I am facing an issue with the black bar at the bottom of the slider not stretching full-width on the screen. While it works fine on the left, the right side is cut off at the container edge. I am using Master Slider if that's relevant information. Can ...

Tips to instantiate an object of a different JavaScript class in Node.js

Hey there! I'm having trouble creating an instance of ProfileComparator in a different JavaScript file called index.js. Can someone help me resolve this error? strategy.js var cosineUtils = require("./jscosine"); var ProfileComparator = function(al ...

Can you explain the purpose of prevState within the setState method of a functional component?

When returning the updated previous state within a setState method retrieved from the useState hook, it appears that the state remains unchanged. To demonstrate this behavior, consider running the following code snippet: function App(){ const [state, ...

Create a footer section positioned at the bottom of the webpage

I am facing an issue with my code, which you can find here: http://jsfiddle.net/NSzdm/ The problem arises when I try to place a footer at the bottom of the page. The layout I desire is for the main content wrapper to be centered, but the footer should co ...

The SetTimeout() function is not functioning as intended

Looking to refresh a div every 10 seconds with a simple task. function updateContent(){ alert('asd'); $('#maincontent').load('providerpage.php?allimages=1 #maincontent > *'); } window.onload=function(){ setTim ...

Can a Nuxt 2 project support the coexistence of both JavaScript and TypeScript?

I am currently working on a project in Nuxt 2.17.2 that is entirely written in JavaScript, but now I need to integrate some SDKs that are written in TypeScript. My goal is to configure the project in a way that allows me to seamlessly run both TypeScript ...

How do you find the value of a variable in IE 9 debugger?

Having an issue with my code on IE 9, it works fine in Firefox: var denomAmount = j(this).closest('.denom').children('.denomValue').eq(0).val(); I'm trying to understand what eq(0) will return, but the IE9 debugger is not providi ...