jQuery addClass example
Change class name on click in jQuery
by bryiantan
HTML
<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>
JavaScript
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 = ($('#4').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"
})
});