Answered
I've got the coding for a credit card interest fees calculator and would like to embed this as a passage format question (or as part of a passage format question) but when I select 'embed code' and click on Code, then enter the coding, it doesn't give a place for the result calculated to show up. Here's the coding I'm using:
<!DOCTYPE html>
<html>
<head>
<title>Credit Card Interest Calculator</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="calculator">
<h1>Credit Card Interest Calculator</h1>
<label for="balance">Initial Balance ($):</label>
<input type="number" id="balance" placeholder="Enter balance">
<label for="rate">Annual Interest Rate (%):</label>
<input type="number" id="rate" placeholder="Enter interest rate">
<label for="payment">Monthly Payment ($):</label>
<input type="number" id="payment" placeholder="Enter monthly payment">
<button id="calculate">Calculate</button>
<p id="result"></p>
</div>
<script src="script.js"></script>
</body>
</html>
After entering the data and clicking 'Calculate' nothing happens...Can you help?
Comments (1)
Hi Laura,
Your desired behavior can be achieved by utilizing in-line JavaScript. You may utilize the following code as an example. It can either be added to the passage question with the "Embed content" or "Code view" buttons in the toolbar of the rich text editor:
Depending on your needs, you may need to edit this example code. Additionally, you may want to consider reaching out to a developer or publisher familiar with creating and editing such content.