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.

<?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%

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:

alert(document.getElementById("txt").value);
// 
alert($("#txt").val());