Type Here to Get Search Results !

How to add feedback form on blogger / WordPress website

  


How to implement code follow steps after
below code 

<div class="container" id="feedbackContainer">

        <h1>Share Your Valuable Feedback</h1>


        <form action="https://formspree.io/f/mknlaprj" method="POST">

            <div class="form-group">

                <label>Your Name:</label>

                <input id="customerName" name="customerName" required="" type="text" />

            </div>


            <div class="form-group">

                <label>Your Email:</label>

                <input id="customerEmail" name="customerEmail" required="" type="email" />

            </div>


            <div class="form-group">

                <label>Feedback:</label>

                <textarea id="feedback" name="feedback" required="" rows="4"></textarea>

            </div>


            <div class="form-group">

                <label>Rating:</label>

                <div class="rating">

                    <input id="star5" name="rating" required="" type="radio" value="Excellent" />

                    <label title="Excellent">★</label>

                    <input id="star4" name="rating" required="" type="radio" value="Good" />

                    <label title="Good">★</label>

                    <input id="star3" name="rating" required="" type="radio" value="Average" />

                    <label title="Average">★</label>

                    <input id="star2" name="rating" required="" type="radio" value="Bad" />

                    <label title="Bad">★</label>

                </div>

                <p id="ratingText">Selected Rating: None</p>

            </div>


            <button type="submit">Submit Feedback</button>

        </form>

    </div>


    <div class="container" id="thankYouContainer" style="display: none;">

        <h2>Thank you for sharing your valuable feedback!</h2>

        <button onclick="goBack()">Back</button>

    </div>


<script>

    // Get the elements

    const ratingText = document.getElementById("ratingText");

    const star5 = document.getElementById("star5");

    const star4 = document.getElementById("star4");

    const star3 = document.getElementById("star3");

    const star2 = document.getElementById("star2");


    // Add event listeners

    star5.addEventListener("click", () => updateRatingText("Excellent"));

    star4.addEventListener("click", () => updateRatingText("Good"));

    star3.addEventListener("click", () => updateRatingText("Average"));

    star2.addEventListener("click", () => updateRatingText("Bad"));


    // Function to update the rating text

    function updateRatingText(rating) {

        ratingText.textContent = `Selected Rating: ${rating}`;

    }


    function goBack() {

        document.getElementById("feedbackForm").reset();

        document.getElementById("feedbackContainer").style.display = "block";

        document.getElementById("thankYouContainer").style.display = "none";

    }

</script>


<style>

    /* Add your existing styles here */

    .container {

        max-width: 400px;

        margin: 50px auto;

        background-color: #fff;

        padding: 10px;

        border-radius: 10px;

        text-align: center;

    }


    h1, h2 {

        color: #333;

    }


    .form-group {

        margin-bottom: 10px;

    }


    label {

        display: block;

        font-weight: bold;

        margin-bottom: 5px;

    }


    input,

    textarea,

    select {

        width: 100%;

        padding: 10px;

        box-sizing: border-box;

        border: 1px solid #ddd;

        border-radius: 5px;

        font-size: 16px;

    }


    .rating {

        display: flex;

        justify-content: space-between;

        margin-bottom: 15px;

    }


    .rating input {

        display: none;

    }


    .rating label {

        cursor: pointer;

        font-size: 2em;

        color: #ccc;

        transition: color 0.3s ease;

    }


    #star5:checked + label {

        color: darkgreen;

    }


    #star4:checked + label {

        color: green;

    }


    #star3:checked + label {

        color: yellow;

    }


    #star2:checked + label {

        color: red;

    }


    p {

        margin: 10px 0;

        font-weight: bold;

    }


    button {

        background-color: #4caf50;

        color: #fff;

        padding: 12px;

        border: none;

        border-radius: 5px;

        cursor: pointer;

        font-size: 16px;

        transition: background-color 0.3s ease;

    }


    button:hover {

        background-color: #45a049;

    }

</style>


To implement the functionality on your Blogger blog, follow these steps:

1. Open Blogger:
   - Log in to your Blogger account.

2. Go to 'Layout' and click on 'Add a Gadget':
   - Navigate to the 'Layout' section of your Blogger dashboard.
   - Click on 'Add a Gadget'
.




3. Select 'HTML/Javascript Gadget':
   - From the list of available gadgets, select the 'HTML/Javascript' gadget.

4. Paste the provided code directly into the gadget:
   - Copy the provided code snippet.
   - Paste the code directly into the 'HTML/Javascript' gadget.





5. Save the gadget and visit your blog to see live changes:
   - Save the changes made to the gadget.


Post a Comment

0 Comments