More actions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
// Get the parent element | // Get the parent element | ||
var parentElement = document.getElementById('simple-calc__container'); | var parentElement = document.getElementById('simple-calc__container'); | ||
// Get the span element | // Get the span element to be replaced | ||
var spanElement = document.getElementById('simple-calc__rinput1'); | var spanElement = document.getElementById('simple-calc__rinput1'); | ||
// Create the input element | // Create the input element | ||
| Line 10: | Line 10: | ||
// Set any desired attributes or properties for the input element | // Set any desired attributes or properties for the input element | ||
inputElement.id = ' | inputElement.id = 'inputElementId'; // Set the ID for the input element | ||
inputElement.placeholder = 'Enter a value'; // Set a placeholder text if desired | inputElement.placeholder = 'Enter a value'; // Set a placeholder text if desired | ||
// Replace the span element with the input element | // Replace the span element with the input element | ||
spanElement.parentNode.replaceChild(inputElement, spanElement); | |||
Revision as of 01:10, 25 October 2023
// Get the parent element
var parentElement = document.getElementById('simple-calc__container');
// Get the span element to be replaced
var spanElement = document.getElementById('simple-calc__rinput1');
// Create the input element
var inputElement = document.createElement('input');
inputElement.type = 'text';
// Set any desired attributes or properties for the input element
inputElement.id = 'inputElementId'; // Set the ID for the input element
inputElement.placeholder = 'Enter a value'; // Set a placeholder text if desired
// Replace the span element with the input element
spanElement.parentNode.replaceChild(inputElement, spanElement);
//
var i = 1;
var l = 4;
var j = 1;
var k = 40;
var answers = [
(i + (i * (l - k) * 0.01) - ((i + (i * (l - 2) * 0.01)) * (j - 1) * 0.09))
];
console.log('Your answer is (' + answers[0] + ')');