Mon Dec 31, 2012 12:34 pm
<html>
<head>
<title>Change html content of an HTML element </title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
$("#change1").click(function(){
$("#div3").html($("#div3").html()+"<br/>"+$("#div2").html());
});
$("#change2").click(function(){
alert("Text: " + $("#div1").text());
});
});
</script>
</head>
<body>
<p id="test">There are three div elements </p>
<div id="div1" hidden="True">Include text to be copied to another div</div>
<div id="div2"><input type="text" value="Type Here..." /></div>
<div id="div3"></div>
<button id="change1">Add Input Field</button>
<button id="change2">Print Text</button>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.