jquery how to make new div inheriting textbox value

Jul 18 2013 3:51 AM

 hey

Can anyone please assist me i am stuck on this for a while now and cant really find it on google because i don't know how to put this question...



i'm learning jQuery on my own and a !st year in Web Development. I want to make a blog but a simple one it should function like a real one but just using jQuery.

I had an idea view the code below....

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication8._Default" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head runat="server">

<script src="jquery-1.4.2.min.js" type="text/javascript"></script>

<script type="text/javascript">

$(document).ready(

function() {

var valOftxt = $(':text').Text;

$(

':submit').click(function() {

$(

"<div></div>").prependTo('#div1');

$(

'div').val('valOftxt');

});

});

</script>

<title></title>

</

head>

<

body>

<form id="form1" runat="server">

<div id="div1">

this is the first div

</div>

<input id="Text1" type="text" />

<input id="Submit1" type="submit" value="submit" />

</form>

</

body>

</

html>





 

well as you can see i am experimenting with this and want to add it to my website i am currently working on for college..can someone please assist me..



 

Thanks


 


Answers (4)