Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:BakiDance/common.js: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
// Get the parent element that contains the span
// Get the parent element
var parentElement = document.getElementById('simple-calc__container'); // Replace 'parentElementId' with the ID of the parent element
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'); // Replace 'spanElementId' with the ID of the span element
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 = 'simple-calc__input1'; // Set the ID 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
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
parentElement.replaceChild(inputElement, spanElement);
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] + ')');