EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MSAG on November 04, 2018, 10:29:49 AM



Title: how can Change buttontext of searchbox by javascript?
Post by: MSAG on November 04, 2018, 10:29:49 AM
Hi
how can Change buttontext of searchbox by javascript?


Title: Re: how can Change buttontext of searchbox by javascript?
Post by: stworthy on November 05, 2018, 02:14:00 AM
You can call 'selectName' method to change the category name on the button.
Code:
<input id="sb" class="easyui-searchbox" data-options="prompt:'Please Input Value',menu:'#mm',searcher:doSearch" style="width:100%">
<script>
$(function(){
$('#sb').searchbox('selectName','sports')
})
</script>


Title: Re: how can Change buttontext of searchbox by javascript?
Post by: MSAG on November 05, 2018, 03:10:40 AM
thanks for your reply

but i didn't change category text

that is what I mean

<input id="sb" class="easyui-searchbox" data-options="buttonText:'This Text',buttonIcon:'icon-Filter',prompt:'Please Input Value',menu:'#mm',searcher:doSearch" style="width:100%">

buttonText that is from TextBox and SearchBox

can I change it from javascript?



Title: Re: how can Change buttontext of searchbox by javascript?
Post by: stworthy on November 05, 2018, 05:10:42 PM
Please try this code to append a new button to the searchbox component.
Code:
var btn = $('<a href="#" class="textbox-button textbox-button-right"></a>').appendTo($('#sb').next());
btn.linkbutton({
  text:'This Text',
  iconCls:'icon-filter'
});
$('#sb').searchbox('resize')