2017-05-09 29 views
0

我在NewForm.aspx中有一個SharePoint「保存」按鈕,我試圖通過jQuery禁用它。 按鈕被示出爲在下面F12:使用jQuery禁用基於值的SharePoint OOB按鈕

<input name="ctl00$ctl30$g_3bef9488_b9f0_405d_b989_cdfc35172f0d$ctl00$toolBarTbl$RightRptControls$ctl00$ctl00$diidIOSaveItem" class="ms-ButtonHeightWidth" id="ctl00_ctl30_g_3bef9488_b9f0_405d_b989_cdfc35172f0d_ctl00_toolBarTbl_RightRptControls_ctl00_ctl00_diidIOSaveItem" accesskey="O" onclick="if (!PreSaveItem()) return false;if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')) return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ctl30$g_3bef9488_b9f0_405d_b989_cdfc35172f0d$ctl00$toolBarTbl$RightRptControls$ctl00$ctl00$diidIOSaveItem&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" type="button" value="Save" target="_self"> 

是否有可能在Jquery的通過檢查其值禁用按鈕。我的意思是,如果該值顯示爲「保存」,那麼禁用該按鈕? 謝謝

回答

0

獲取其值屬性以'保存'結尾並禁用它的元素。

$("input[value$='Save']").attr('disabled',true);