将表单模板内容添加到 HTML

我正在尝试将表单模板发布到位于不同位置的主页:我的代码如下所示:


<!DOCTYPE HTML>

<html>

    <head>

        <script src="js/Jquery.js"></script>

        <link rel="stylesheet" type="text/css" href="css/style.css">

        <title>Test</title>

        <style>

        html

        {

            -webkit-background-size:cover;

            -moz-background-size:cover;

            -o-background-size:cover;

            background-size:cover;

        }

        </style>

    </head>

    <body>

        <select name="Template_Picker" id="Template_Picker">

            <option value="payment">payment</option>

            <option value="identity">identity</option>

        </select>

        <br>

        <div id="Templates_Pages">

            <button class="Template" value="Send" id="Template_Button">Show selected</button>

        </div>

        <form action="test/submit.php" method="post" id="submit_template">

            <input type="hidden" id="payment" name="payment" value="payment">

            <center id="output">


            </center>

        </form>

    </body>

    <script src="test/template.js"></script>

</html>

我正在尝试使用如下所示的表单模板:


<div id="template" class="template">

    <input type="text" placeholder="Full Name" name="Full_Name">

    <input type="text" placeholder="Credit Card" name="Credit_Card">

</div>

并将她放在我的主页上,所以 JS 看起来像这样:


$(".Template").click(function(){

    template_p = ($('#Template_Picker').val());

        $.get("test\\"+template_p+".php",function(output){

            $("#template_p").append(output);

//template_p = payment when choosing 

    });

});

当我在我的 JS 上选择“template_p”时它不起作用,但是当我使用中心 id “输出”时它起作用,为什么?


慕妹3242003
浏览 114回答 1
1回答

慕村9548890

看起来您无法将输出附加到“输入”标签。所以我继续使用“中心”标签。
打开App,查看更多内容
随时随地看视频慕课网APP