Create a javascript script to create the following element:
Nom Recette
Préparation
Cuisson
15 minutes
25 minutes
Assistant
Here is a JavaScript script to create the HTML element you mentioned:
javascript
// Create the outer div element with class "card col-md-3 mx-3 mb-3 border-3"
const outerDiv = document.createElement("div");
outerDiv.classList.add("card", "col-md-3", "mx-3", "mb-3", "border-3");
// Create the inner div element with class "card-body"
const innerDiv = document.createElement("div");
innerDiv.classList.add("card-body");
// Create the h5 element with class "card-title text-success-emphasis fw-semibold" and text "Nom Recette"
const h5 = document.createElement("h5");
h5.classList.add("card-title", "text-success-emphasis", "fw-semibold");
h5.textContent = "Nom Recette";
// Create the outer div for card-text with class "d-flex"
const cardTextOuterDiv = document.createElement("div");
cardTextOuterDiv.classList.add("card-text", "d-flex");
// Create the inner div for the first column of card-text with class "d-flex flex-column"
const firstColumnDiv = document.createElement("div");
firstColumnDiv.classList.add("d-flex", "flex-column");
// Create the first span with the clock icon and preparation time
const preparationSpan = document.createElement("span");
preparationSpan.innerHTML = '<i class="fa-regular fa-clock"></i> Préparation';
// Create the second span with the temperature icon and cooking time
const cookingSpan = document.createElement("span");
cookingSpan.innerHTML = '<i class="fa-solid fa-temperature-high"></i> Cuisson';
// Create the inner div for the second column of card-text with class "d-flex flex-column ms-4"
const secondColumnDiv = document.createElement("div");
secondColumnDiv.classList.add("d-flex", "flex-column", "ms-4");
// Create the span for the preparation time
const preparationTimeSpan = document.createElement("span");
preparationTimeSpan.textContent = "15 minutes";
// Create the span for the cooking time
const cookingTimeSpan = document.createElement("span");
cookingTimeSpan.textContent = "25 minutes";
// Append the elements to their respective parents
outerDiv.appendChild(innerDiv);
innerDiv.appendChild(h5);
innerDiv.appendChild(cardTextOuterDiv);
cardTextOuterDiv.appendChild(firstColumnDiv);
cardTextOuterDiv.appendChild(secondColumnDiv);
firstColumnDiv.appendChild(preparationSpan);
firstColumnDiv.appendChild(cookingSpan);
secondColumnDiv.appendChild(preparationTimeSpan);
secondColumnDiv.appendChild(cookingTimeSpan);
// Append the outer div to the document body or any other desired parent element
document.body.appendChild(outerDiv);
To use this script, ensure that you have the required FontAwesome icons (fa-regular fa-clock and fa-solid fa-temperature-high) in your project. If not, you can replace those class names with appropriate icons that you have available.