This is the code used to enter information from steps 1 to 3 and display the data entered in step 4, but when entering data in step 3, the data in step 4 is not seen. Currently I am using the next part. Follow and previous buttons to save and update data in steps 1, 2, 3 and display entered data in step 4. Note: I'm using the jQuery smart wizard library Someone help me!!!!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Smart Wizard</title>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
type="text/javascript"
></script>
<script
src="https://cdn.jsdelivr.net/npm/smartwizard@6/dist/js/jquery.smartWizard.min.js"
type="text/javascript"
></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/smartwizard@6/dist/css/smart_wizard_dots.min.css"
/>
</head>
<body>
<div class="container">
<h2>Smart Wizard</h2>
<div id="smartwizard">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link" href="#step-1">Bước 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#step-2">Bước 2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#step-3">Bước 3</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#step-4">Bước 4</a>
</li>
</ul>
<div class="tab-content">
<div
id="step-1"
class="tab-pane"
role="tabpanel"
aria-labelledby="step-1"
>
<input
type="text"
id="inputStep1"
placeholder="Nhập dữ liệu cho Bước 1"
/>
</div>
<div
id="step-2"
class="tab-pane"
role="tabpanel"
aria-labelledby="step-2"
>
<input
type="text"
id="inputStep2"
placeholder="Nhập dữ liệu cho Bước 2"
/>
</div>
<div
id="step-3"
class="tab-pane"
role="tabpanel"
aria-labelledby="step-3"
>
<input
type="text"
id="inputStep3"
placeholder="Nhập dữ liệu cho Bước 3"
/>
</div>
<div
id="step-4"
class="tab-pane"
role="tabpanel"
aria-labelledby="step-4"
>
<h2>Bước 4</h2>
<div id="step4Data"></div>
</div>
</div>
<div class="progress">
<div
class="progress-bar"
role="progressbar"
style="width: 0%"
aria-valuenow="0"
aria-valuemin="0"
aria-valuemax="100"
></div>
</div>
</div>
<script>
$(document).ready(function () {
var selected;
//Initialize Smart Wizard
$("#smartwizard").smartWizard({
selected: 0,
theme: "arrows",
transitionEffect: "fade",
toolbarSettings: { toolbarPosition: "both" },
});
//To retrieve values of selected indexes on click of save button
$("#save").on("click", function () {
alert("The selected index is: " + selected);
});
//This code will trigger the select event of the Smart Wizard when a step is clicked
$("#smartwizard").on(
"showStep",
function (e, anchorObject, stepNumber, stepDirection) {
selected = stepNumber; //Store the selected index
}
);
});
</script>
</div>
</body>
</html>
I'm having trouble with this part and don't have a solution. I hope someone can help me rewrite it