如何使用jquery获取此文本框值 [英] How get this textbox value by using jquery

查看:77
本文介绍了如何使用jquery获取此文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他,

一天的问候!



这里我需要知道如何使用jquery获取克隆的文本框值Asp.Net.MVC



我的尝试:



he,
greetings of a day !

here i need to know how i get a cloned textbox value by using jquery in Asp.Net.MVC

What I have tried:

@model Clone.Models.Myclone

@{
	ViewBag.Title = "Index";
}

<h2>Index</h2>
<html>
<head>

</head>
<body>
	<div>
		<input type="text" id="1" />
		<p><input type="button" id="bt" value="Clone it" class="btn btn-success" /></p>
		<p><input type="button" id="bt2" value="Clone Msg" class="btn btn-danger" /></p>
	</div>
	<div id="mycln" class="cln1">
		<table class="table table-responsive table-hover table-bordered" id="orderdetailsItems"><tbody></tbody></table>

	</div>


</body>
</html>
<link href="~/Content/bootstrap-theme.min.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
@section scripts{
	<script src="~/Scripts/jquery-3.3.1.min.js"></script>
	<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

	<script>


		var iCnt = 1;
		$(document).ready(function () {
			$('#bt').on('click', function () {
					iCnt += 1;
					$('#1')
						.clone(true, true)
						.attr('id', iCnt)
						.appendTo("body");
			});

			$('input').on('change', function () {
				alert(this.value);
			});
		});
		$(document).ready(function () {
			$('#bt2').on('click', function () {
				var xid = ($('#iCnt').val());
			
				alert(this.value);
			// how i get here textbox value in a new veriabel 
				// when i am trying to get msg then alert only Show  a massage  "clone msg"
				 
			})
		});
	</script>
}

推荐答案

(document).ready(function(){
(document).ready(function () {


('#bt')。on('click',function(){
iCnt + = 1;
('#bt').on('click', function () { iCnt += 1;


('#1')
.clone( true,true)
.attr('id',iCnt)
.appendTo(body);
});
('#1') .clone(true, true) .attr('id', iCnt) .appendTo("body"); });


这篇关于如何使用jquery获取此文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆