Pull into text field

Like from

<div class='panel' style='width:200px;'  id='d_{$row['id']}'>
{$row['id']}  {$row['name']}<div class='selo' >

Pull into <input id="tex" type="text" name="tex">field {$row['name']}into modal window?

<?php
require_once "conf.php";
?>
<head>
<body> 
<?php
dbConnect();
$zapros=mysql_query("select * from spr_otdel") or die (mysql_error);
while ($row=mysql_fetch_array($zapros)){
echo "
<div class='panel' style='width:200px;'  id='d_{$row['id']}'>
{$row['id']}  {$row['name']}<div class='selo' ><a href='#' class='btn-delete'  onclick='return delet(\"{$row['id']}\")'></a> | <a href='#' class='edit'></a></div></div>";
}
?>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery.ui.dialog.js"></script>
<style type="text/css">
body {
    font-size: 62.5%;
}
.panel {
    background: #ffffff;
    padding: 10px 20px 10px;
    position: relative;
    border-top: solid 1px #ccc
    }
.alt {
    background: #f5f4f4;
    }
.selo {
    font-size: 8pt;
    }
</style>
 <script type="text/javascript">
$(document).ready(function(){
    $(".panel:even").addClass("alt");
        $(".panel .edit").click(function(){
    $(function() {
        $( "#dialog" ).dialog();
    });
$( "#dialog" ).dialog({ buttons: [
    {
        text: "Ok",
        click: function() { $(this).dialog("close"); }
    }
]
 })})});
function delet(id) {
        $( "#del" ).dialog({ 
        title:" ",
        buttons:
    {
        "": function() {
        $("#d_"+id).animate({ backgroundColor: "#fbc7c7" }, "fast")
        .animate({ opacity: "hide" }, "slow");
        $(this).dialog("close");},
        "": function() { $(this).dialog("close"); }
    }
 });     
        return false;
    }
</script> 
<div id="del" style='display:none;text-align:center;font-size:10px;'>
  ?
</div>
<div id="dialog" style='display:none;font-size:10px;' title=''>
<input id="tex" type="textarea">
</div>
</head>
</body> 
</html>

Answer 1, authority 100%

Include jquery library

Js code:

var data;
data=$('div.panel').html();
document.GetElementById('tex').value=data;

The second line passes to the data variable everything that is enclosed in the ‘div’ tag of the ‘panel’ class (Thanks to the jquery library).
The third line writes the ‘data’ variable to the input with “id=’text'”

but better like this:

document.GetElementById('tex').value=$('div.panel').html();