javascriptinputdialogjquery-easyui

Setting Default value of input textbox in Jquery EasyUI dialog


I have googled and looked throughout the whole documentation and could not figure out why value of input text is not shown. I am using FireFox latest version and below is what I have done so far.

 <input name="amount" class="easyui-validatebox" id="d_amount" value="">

In regular html or php page we can give value="300" to set default value, but in EasyUI, it is not possible. So I was thinking possible alternative like below:

  <script>
   var m = '300';
   document.getElementById("d_amount").value.innerHTML=m;
  </script>

Nothing is shown and I am not getting any error. Any EasyUI expert, please help me.

NOTE: this input field is inside the dialog


Solution

  • I found the answer here. The trick is to use the code inside $(function(){});

    $(function(){
        var m=300;
        $('#d_amount').textbox('setValue', m);
    });