javascript or jquery error -


i have below code jquery. jquery not working? have 2 alertbox in javascript second alertbox not show , first alertbox show. no console errors.

    function validateform(){        alert("start of validateform"); <-- line show         var errmsg = "";         if ($("#accountname").val() == ""){             $("#accountname").attr("class", "text_field text2 error_yellow");             errmsg = errmsg + "<tld:label id="registration.step1.error.accountname" />";         }         else{             $("#accountname").attr("class", "text_field text2");         }         alert("validateform"); <-- not going line         ...................     }  <s:form action="registration" method="post" id="registrationform">      <div class="field_input">         <select name="registrationform.accountname"          value="${registrationform.accountname}"         styleid="accountname" styleclass="text_field text2">             <option value=""><tld:label id="reg1.request.detail14" /></option>             <option                 value="<%=membersiteconstant.member_account_type_credit_card%>"><tld:label id="registration.step1.option.card" /></option>             <option                 value="<%=membersiteconstant.member_account_type_hp_pl%>"><tld:label id="registration.step1.option.loan" /></option>         </select>     </div>  <a id="a_btn_submit" href="javascript:validateform()" class="formbutton"><tld:label id="registration.button.next" /></a> 

your string isn't enclosed in line:

errmsg = errmsg + "<tld:label id="registration.step1.error.accountname" />"; 

try replacing with:

errmsg = errmsg + "<tld:label id='registration.step1.error.accountname' />"; 

or

errmsg = errmsg + "<tld:label id=\"registration.step1.error.accountname\" />"; 

p.s: pro tip use browser console view js error. press f12 in chrome or ie or ff view browser console , navigate console menu view js errors


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -