简体   繁体   English

jquery 点击按钮显示具体模板

[英]jquery click on button display specific template

Problem问题在此处输入图像描述

I am facing an issue in javascript, i want to do if user click on send button they show that template name a/c to table我在 javascript 中遇到问题,如果用户单击send button ,他们会显示模板名称 a/c 到表中,我想这样做

For example: if user click on send button then display template name checked .例如:如果用户单击send button ,则显示模板名称checked

what should i do?我应该怎么办? Anyone help me?有人帮我吗?

My code here:我的代码在这里:

                $(document).on("click", "#send", function (e){
                    
                    var tempname = $(this).closest("tr").find("td.name").text();       //template data
                    var tempbody = $(this).closest("tr").find("td.body").text();   

                    console.log("tempname",tempname);
                    console.log("tempbody",tempbody);
                }
            });


            <tr class="template_lists" scope="row">
                <td style="display:none" class="index" ></td>
                <td class="name"></td>
                <td class="body" hidden></td>
                <td>
                <button type="button" id="send" class="btn btn-default">Submit</button>
</td>

expected output预计 output 在此处输入图像描述

Like this?像这样?

$(document).on("click", "#send", function (e){
          $(this).closest("tr").find("td.name").html('checked');
                }
            });

I can't really understand what you mean.我真的不明白你的意思。 If I was wrong, you can comment on me~如果我错了,你可以评论我~

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM