Modal windows

How to set the value of the text field <input id="tex" type="textarea">?
All procedures should take place in a modal window.

require_once "conf.php";
$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="" rel="stylesheet" type="text/css"/>
  <script src=""></script>
  <script src=""></script>
 <script src=""></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;
 <script type="text/javascript">
        $(".panel .edit").click(function(){
    $(function() {
        $( "#dialog" ).dialog();
$( "#dialog" ).dialog({ buttons: [
        text: "Ok",
        click: function() { $(this).dialog("close"); }
function delet(id) {
        $( "#del" ).dialog({ 
        title:" ",
        "": function() {
        $("#d_"+id).animate({ backgroundColor: "#fbc7c7" }, "fast")
        .animate({ opacity: "hide" }, "slow");
        "": function() { $(this).dialog("close"); }
        return false;
<div id="del" style='display:none;text-align:center;font-size:10px;'>
<div id="dialog" style='display:none;font-size:10px;' title=''>
<input id="tex" type="textarea">

Answer 1, authority 100%

Perhaps by textarea you meant multiline field:

<textarea rows="10" cols="45" name="txt" id="txt">A multiline text</textarea>

In contrast to the single line <input type="text" id="txt" value="Single line" />, text is enclosed between tags. In this case, from JavaScript, you can refer to the value in the same way: