2016-02-01 26 views

回答

0

假設你正在使用直JS使用DOM,使用此:

<input id="txtSearch" value="Clear Me"> 
<ons-button onclick="document.getElementById('txtSearch').value='';">Clear</ons-button> 

編輯:添加另一個下來,骯髒的解決方案,使用簡單的CSS此:

<input id="txtSearch" value="Clear Me"> 
<ons-icon icon="ion-close" size="20px" fixed-width="true" style="margin-left:-25px" onclick="document.getElementById('txtSearch').value='';"></ons-icon> 
+0

我希望的是解決方案將按鈕放在輸入中,而不是在旁邊/下面... – MoreScratch

+0

編輯添加您尋求的東西。你可能需要玩一下你的css,但這是最簡單而最簡單的方式,而不需要進行一堆引導。 – Munsterlander

相關問題