EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on January 03, 2026, 06:43:07 AM



Title: [SOLVED]Change text in menu item by ID
Post by: jega on January 03, 2026, 06:43:07 AM
Looking for a way to change the text dynamicaly

<div id="menu_setup" class="easyui-menu">
   <div id="upload" data-options="iconCls:'icon-upload'">
      <span>(1) Upload</span>
         <div>
            <div id="objID" data-options="iconCls:'icon-imageupload'">TEXT TO CHANGE</div>
         </div>
   </div>
</div>

Tried $('#objID').html('Changed text') and $('#objID').text('Changed text') whiuch both change the text but now there is no icon class and text starts from icon place. See attachement


Happy New Year

Jesper


Title: Re: Change text in menu item by ID
Post by: jega on January 03, 2026, 04:16:02 PM
Found solution

var item = $('#menu_setup').menu('findItem', {id:'objID'});
$('#menu_setup').menu('setText', {
   target: item.target,
   text: 'New Text'
})

Or if you want så search by name

var item = $('#menu_setup').menu('findItem', {name:'xxx'});