English 中文(简体)
基本生活联系方式
原标题:Basic jQuery contact form issue

I muck written j Query accreditation for a Liaison form. 我写了一部简单的法典,将检查输入表是否含有任何特性;如果具有任何特性,它可能继续管理购买力平价代码,并寄给我电子邮件。 否则,就会发现一个错误的盒子,告诉客户要进行双重检查。 该守则是:

    (function($){
       $( .required ,$form).each(function(){
         var inputVal = $( form-element-name ).val();
         var inputVal2 = $( form-element-email ).val();

                if(inputVal ==   ){
                    $( errorbox1 ).addClass( errormsg1 );
                } 

                else if(inputVal2 ==   ) {
                    $( errorbox2 ).addclass( errormsg2 );
                }
            }
     }

Inputval is the inputfield for the name and inputval2 is the inputfield for the e-mail. Furthermore, Errorbox1 is a container that is empty and the errormsg1 would be the class that would give the errorbox1 a background-image saying error.

rel=“nofollow> 这里是个支部。

最佳回答

$( errorbox1 ) and $( errorbox2 )

应当:

$(error Box1 ) and $(error Box2 )

or

$(#error Box1 ) and $(#error Box2

注:错误方框1之前的斜线/端。

下面是班级和工地选任人。

http://api.jquery.com/class-selector/

http://api.jquery.com/id-selector/“rel=“nofollow”http://api.jquery.com/id-selector/

问题回答

它认为你从贵格·克列斯的挑选人那里找不到散列单——你应该有<条码>,而不是<条码>(形式-名称)——根据背书选择内容。

Or - a dot to select by class instead.

您需要将您的代码放在提交时的表格中,return false;或使用e.preventDefault();,以取消提交表格。

$( #your-form-id ).submit(function() {
    // if error then cancel form submission
});




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签