how to show alert "data already exists"

i newbie this my first project,I don't know how to resolve any problems about the repetition of data i have an input page. it consist of 2 textfield: 1. Model, 2. Serial, and one combobox: 1. line. i want if there is input twice, I mean here is a double input data, will be out warning **"data already exists"**. how do i do that?i try like this but doesn't work: $("#input").click(function() { if($("#submit").valid()) { var params=$("#submit").serialize(); $.ajax({ type:"post", url:"process1.php", data:params, cache :false, async :false, success : function() { $('input[name^="text"]').change(function() { var $current = $(this); $('input[name^="text"]').each(function() { if ($(this).val() == $current.val() && $(this).attr('id') != $current.attr('id')) { alert('data already exists!'); } }); }); $("#showmodel").val($("#model").val()); $("#showline").val($("#line").val());

以上就是how to show alert "data already exists"的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏