javascriptjqueryjquery-easyui

How to set content to easyui panel with javascript


I have a problem in using easyui panel, so I am here needing somebody's help , even thought i find a few people use easyui in stackoverflow.

I have a panel in my page like:

<div  class="easyui-panel" title="" id="pp"  closed="true" style="width:100%">
</div>

And then, I want to put a value of a input value to this pp panel.

The input value and button code is :

<input type="text" style="width:97%;height:40px" id="drafterId" value='ths'>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="drafter()" data-options="plain:true,iconCls:'icon-man'">bt</a>

Now I want to use drafter function when clicking linkbutton to realize it :

function drafter()
{
    var drf=$("#drafterId").val();
    alert(drf);//works OK
    var drfN="<tr>"+drf+"</tr>";

    $('#pp').panel('refresh', 'drf');   //works fail
}

But unlucky, $('#pp').panel('refresh', 'drf');works fail. I have tried another way:

$('#pp').html(drf);

and

$('#pp').innerHTML(drf);

They both failed. Who can help me?


Solution

  • $('#pp').append(drf); works OK