首页 > Web开发 > 详细

jQuery 标签后加提示信息

时间:2015-07-23 10:39:29      阅读:196      评论:0      收藏:0      [点我收藏+]

html 部分

<input type="text" id="test" onclick="check();"></input>

 

jquery 部分

function msgshow(tar,msginfo){
  tar.after("<span datatype=‘msg‘ style=‘color:red‘>"+msginfo+"</span>");
}
function msghide(tar){
  tar.nextAll().each(function(){
    var dt=$(this).attr("datatype");
    if(dt=="msg"){
      $(this).remove();
    }
  });
}

function check(){

  var id=$("#id");

  if(id.val()!=""){

    megshow(id,"内容不能为空!");

  }

  else{

    meghide(id);

  }

};

jQuery 标签后加提示信息

原文:http://www.cnblogs.com/tianzhiyun/p/4669674.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!