隐藏sharepoint中搜索框的文本

时间:2018-02-05 07:59:10

标签: search sharepoint hide

我想要隐藏searchtextbox的文本,但我不知道该怎么做。我是一个Sharepoint noob,所以我觉得很容易做到,但我不知道如何...我把我的代码放在下面,希望它有所帮助:

<SharePoint:AjaxDelta ID="DeltaSiteLogo" runat="server" BlockElement="True">
<!--search-->
<SharePoint:AjaxDelta ID="DeltaPlaceHolderSearchArea" BlockElement="true" CssClass="ms-mpSearchBox ms-floatRight" runat="server">
    <asp:ContentPlaceHolder ID="PlaceHolderSearchArea" runat="server">
        <div id="searchInputBox">
            <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
            <script type="text/javascript">
                setTimeout(function () {
                    document.getElementById('SmallSearchInputBox').placeholder = 'Ex: SMS1234';
                    document.getElementById('SmallSearchInputBox').value = 'Ex: SMS1234';
                }, 800);//time to wait for in ms
            </script>
        </div>
    </asp:ContentPlaceHolder>
</SharePoint:AjaxDelta>
<SharePoint:SPLinkButton runat="server" CssClass="ms-siteicon-a" ID="x36d5bee949a7480783b3afc048c15598" NavigateUrl="~sitecollection/Pages/Inicio.aspx">
    <SharePoint:SiteLogoImage name="onetidHeadbnnr0" runat="server" CssClass="ms-siteicon-img" ID="x74bbee6762f840edad4fe46f496d8c78" LogoImageUrl="/_layouts/15/images/siteIcon.png"></SharePoint:SiteLogoImage>
</SharePoint:SPLinkButton>

我关注this link,但此解决方案对我不起作用,并且它不会更改文本框的文本:

任何人都可以帮助我吗?非常感谢!

1 个答案:

答案 0 :(得分:0)

控件ID将随页面继承而更改,例如: enter image description here

尝试使用jQuery正则表达式选择器,例如:

$('div[id*="SmallSearchInputBox"]')