簡體   English   中英

jQuery UI的突出顯示效果可以應用於表單文本輸入嗎?

[英]Can jQuery UI’s highlight effect be applied to a form text input?

想知道jQuery UI的“突出顯示”效果是否可用於表單文本輸入。 我想設置背景顏色的動畫,以指示字段已成功更新(單個字段,由Ajax成功事件觸發的動畫)。

您可以使用Jquery動畫功能。 首先,使用動畫將文本框的背景顏色更改為綠色,以通知用戶已成功保存某些內容,然后可以將其重新設置為原始顏色。 您可以在ajax成功函數中編寫此代碼。

 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>highlight demo</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css"> <style> #toggle { background: #fff; } </style> <script src="//code.jquery.com/jquery-1.12.4.js"></script> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script> </head> <body> <p>Click anywhere to toggle the box.</p> <input id="input-animate"> <script> $( document ).click(function() { $( "#input-animate" ).animate({ backgroundColor: "#009900", easing: "easein" }, 1500 , function(){ $( "#input-animate" ).animate({ backgroundColor: "#fff", }, 500) }) }); </script> </body> </html> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM