Php jQuery提示插件和$\u POST问题

Php jQuery提示插件和$\u POST问题,php,jquery,Php,Jquery,我正在使用 我如何防止这个问题 提前谢谢 编辑:jQuery代码: $(".input").hint(); $(".lSubmit").click(function(e){ e.preventDefault(); $.post('form.php',decodeURIComponent($("#forms").serialize()) , function(data) { $('.result').html(data); }); }); 你不能 只需在代码中添加

我正在使用

我如何防止这个问题

提前谢谢

编辑:jQuery代码:

$(".input").hint();

$(".lSubmit").click(function(e){
   e.preventDefault();
   $.post('form.php',decodeURIComponent($("#forms").serialize()) , function(data) {
   $('.result').html(data);
     });
 });
你不能

只需在代码中添加if语句:

if($_POST['names'] == 'hint' ) {
   //DONT USE IT!!
}

当输入所在的表单被提交时,插件会删除提示本身,不幸的是,您没有提交表单,而是通过
$.post
发布它

最简单的方法可能是在提交输入之前对照其标题检查输入的值,如果它们相同,则清除它们:

$(".lSubmit").click(function(e){

   // clear inputs that still have the hint as value
   $('.input').each(function() {
      if($(this).val() == $(this).attr('title')) {
         $(this).val("");
      }
   });

   e.preventDefault();
   $.post('form.php',decodeURIComponent($("#forms").serialize()) , function(data) {
   $('.result').html(data);
     });
 });

这很奇怪,看看插件代码和演示,它似乎在表单提交时删除了提示。您是否以任何方式绕过表单默认提交?@Björn,我已经编辑了我的问题,谢谢
if($_POST['names'] == 'hint' ) {
   //DONT USE IT!!
}
$(".lSubmit").click(function(e){

   // clear inputs that still have the hint as value
   $('.input').each(function() {
      if($(this).val() == $(this).attr('title')) {
         $(this).val("");
      }
   });

   e.preventDefault();
   $.post('form.php',decodeURIComponent($("#forms").serialize()) , function(data) {
   $('.result').html(data);
     });
 });