保留文本框中的值,直到用户键入

时间:2011-05-02 09:27:07

标签: textbox

我想在此网站上创建一个标题文本框。当用户没有发生任何事情时,当用户键入文本框时,所有内容都将被删除。

1 个答案:

答案 0 :(得分:0)

假设您正在使用html + javascript / jquery

请检查:Create an ASP.NET TextBox Watermark Effect using jQuery

使用jquery的示例脚本

$().ready(function() {
  swapValues = [];
  $(".wm").each(function(i) {
    swapValues[i] = $(this).val();
    $(this).focus(function() {
      if ($(this).val() == swapValues[i]) {