Total members 11890 |It is currently Fri Apr 19, 2024 8:42 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Add new input field at each click- dynamically in JQuery
html code
<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>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Change and get html content of element
 Remove HTML element or Delete its content     -  
 Change the content of select tag using JQuery     -  
 Cant change the culture or UICulture of the content page     -  
 opacity of HTML element- transparent     -  
 Get the position of HTML element using JQuery     -  
 How to make html element hidden using CSS     -  
 removing focus border from a HTML element     -  
 Get Width and Height -Inner and Outer for HTML element     -  
 checking if a HTML element is visible or hidden under JQuery     -  
 Show hint when focus on html element using JQuery     -  



Topic Tags

JQuery Content
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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