Skip to main content

Concatenate form inputs with raw HTML that appends to

I'm trying to make an email builder for my job. I have an accordion with multiple form inputs per accordion(they are all hidden) then used jQuery to clone and append the different accordion forms when a the associated button is pressed.

$(document).ready(function() {
  //Clones the Main feature code, adds it to the bottom of the Accordion and changes display to "Show"
  $("#btn1").click(function() {
    $(".main_feature").first().clone(true, true).appendTo("#accordion").show();
  });
  //Clones the Sub-Feature code, adds it to the bottom of the Accordion and changes display to "Show"
  $("#btn2").click(function() {
    $(".sub_feature").first().clone(true, true).appendTo("#accordion").show();
  });
  //Clones the Banner code, adds it to the bottom of the Accordion and changes display to "Show"
  $("#btn3").click(function() {
    $(".banner").first().clone(true, true).appendTo("#accordion").show();
  });
  $("#btn4").click(function() {
    $(".text").append($("#main").val());

  });
});
<!--Start of Accordion Block-->

<div id="accordion" style="display: inline-block; background-color:#DCDCDC; padding: 10px 5px; min-width: 640px">

  <!--Main Feature Accordion-->

  <div style="display: none" class="s_panel main_feature">
    <button class="remove-btn" style="float: right; margin-top: 10px; margin-right:5px">X</button>
    <h3 style="background-color: lightgoldenrodyellow; padding: 10px;">Main Feature</h3>
    <div style="padding: 20px 0px;background-color:cadetblue">

      <!--Main Feature Form-->

      <div class="form-input">
        <form action="" method="get" class="form-example">
          <div class="form-example">
            <label for="style">Style: </label>
            <input type="text" name="main_style" id="main_style" required/>
          </div>
          <div class="form-example">
            <label for="link">Image Link: </label>
            <input type="text" name="main_img_link" id="main_img_link" required/>
          </div>
          <div class="form-example">
            <label for="link">Web Link: </label>
            <input type="text" name="main_web_link" id="main_web_link" required>
          </div>
          <div class="form-example">
            <label for="price">Price: </label>
            <input type="text" name="main_price" id="main_price" required>
          </div>
          <div class="form-example">
            <label for="description">Description: </label>
            <input type="text" name="main_description" id="main_description" required>
          </div>
        </form>
      </div>
    </div>
  </div>

(This isn't the complete code but I will attach my github link)

Here is what I need help with:

I need to be able to take all the accordion forms and their inputs and concatenate them into the raw HTML that makes up the email.

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding: 20px 0px;">
   <tr>
        <td class="fluid-img" style="font-size: 12px; border: 1px solid #e1e1e1; background-color: #f5f5f5;">
             <a href="www.google.com?utm_source=<!--Date Code-->&utm_medium=email&utm_campaign=<!--Date Code-->">
             <!-- Main Feature Image - Transparent PNG -->
             <img src="https://image.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg" width="100%" border="0" alt="Style Number" />
             </a>
        </td>
   </tr> 
</table>
I've tried using template literals but couldn't get it to append at all to the

I was using as the target.

I apologize for this being confusing.

Via Active questions tagged javascript - Stack Overflow https://ift.tt/XAiNQ1h

Comments

Popular posts from this blog

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console...

How to split a rinex file if I need 24 hours data

Trying to divide rinex file using the command gfzrnx but getting this error. While doing that getting this error msg 'gfzrnx' is not recognized as an internal or external command Trying to split rinex file using the command gfzrnx. also install'gfzrnx'. my doubt is I need to run this program in 'gfzrnx' or in 'cmdprompt'. I am expecting a rinex file with 24 hrs or 1 day data.I Have 48 hrs data in RINEX format. Please help me to solve this issue. source https://stackoverflow.com/questions/75385367/how-to-split-a-rinex-file-if-i-need-24-hours-data