I am new with jquery. i have a work in which i have to generate new component like text etc in a button click.
i succeed to get new component in every click but neither i able to get there value nor know how to store in the database. in this the component like textbox etc are dynamically generated in click.
here below is my code.
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="js/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
<style id="jsbin-css"></style></head>
<body>
<input type="submit" name="submit" id="submit" value="Add"/>
<div id="selectList">
</div>
<script>
$("#submit").bind("click", function() {
$("#selectList").append("<br/><input type='text' id='date' name='date'>"+"<input type='checkbox' id='check' value='In Travel' name='chk'>"+"<textarea name='ta' id='ta' ></textarea>"+"<select id='Reimbursement' name='Reimbursement'><option selected='selected' value='None'>None</option><option value='DA'>DA</option><option value='Ticket'>Ticket</option><option value='Misc'>Misc</option></select>"+"<input type='submit' value='Click' id='click1' class='save' name='click1'>");
});
$(".save").click(function () {
var myarea=$("#ta").val();
alert(myarea);
var checkbox=$("#check").val();
alert(checkbox);
var date=$("#date").val();
alert(date);
var dd=$("#Reimbursement").val();
alert(dd);
return false;
});
</script>
</body>
</html>
Many thanks to all of you..