Php 在输入字段上显示变量而不使用value属性

Php 在输入字段上显示变量而不使用value属性,php,javascript,jquery,Php,Javascript,Jquery,我有一个PHP变量,我试图在不使用“value”属性的情况下将其显示在输入字段中,但我似乎无法使其工作 我尝试了一个我首先找到的jQuery代码,将变量“追加”到输入字段中,但没有成功 var first_name = "<?php echo $current_user['first_name']; ?>"; alert(first_name); $('#first_name').val($('#first_name').val() + first_name)

我有一个PHP变量,我试图在不使用“value”属性的情况下将其显示在输入字段中,但我似乎无法使其工作

我尝试了一个我首先找到的jQuery代码,将变量“追加”到输入字段中,但没有成功

    var first_name = "<?php echo $current_user['first_name']; ?>";
    alert(first_name);
    $('#first_name').val($('#first_name').val() + first_name);
var first_name=”“;
警报(名字);
$('first_name').val($('first_name').val()+first_name);
然后,我尝试使用getElementById,但也不起作用

    var first_name = "<?php echo $current_user['first_name']; ?>";
    alert(first_name);
    document.getElementById('first_name').value = first_name;
var first_name=”“;
警报(名字);
document.getElementById('first_name')。value=first_name;
如有任何建议,将不胜感激

编辑:

这是HTML表单

<form name="personal_form" action="includes/editpersonal.php" method="POST">
   <fieldset>
      <legend><h2>Personal Details</h2></legend>
      <table class="personalform">
         <!--if there is an error on first name, the class name 'form_error_row' will be input into the following tr-->
         <!--allows me to colourise the text field to indicate an error on this row-->
         <tr class="<?php echo form_row_class("first_name") ?>" >
            <th><label for="first_name"><p>First Name: </p></label></th>
            <td>
            <input type="text" name="first_name" id="first_name" size="40" />
            <!--if there is an error it will print out a div with the error message-->
            <?php echo error_for('first_name') ?>
            </td>
          </tr>
      </table>  
   </fieldset>
   <input type="submit" class="reg-button" value="Update Records" />
</form>

个人资料
尝试在中赋值,以确保html元素已准备好供脚本访问

$(document).ready(function(){
 $('#first_name').val($('#first_name').val() + first_name);
});

你能给我看一下房间吗code@PSR请检查编辑,jquery文件code.jquery.com/jquery-1.9.1.js“>code.jquery.com/ui/1.10.1/jquery ui.js”在哪里