How do I handle an if condition in jQuery -
i have class has image
<a class="proceed-btn right" onclick="validateall();" style="cursor: pointer;">proceed next step >>></a>
which has css
.proceed-btn { background:url("images/proceed-btn.gif") no-repeat scroll 0 0 transparent; height:35px; width:275px; }
then on same page have these input fields , links
<input type="text" id="name" name="name" value="" class="field left"> <input type="text" id="company" name="company" value="" class="field left"> <input type="text" id="email" name="email" value="" class="field left"> <a onclick="setindustry('3');" style="cursor: pointer;" class="industry_links highlight">retail</a> <a onclick="setsystems('5');" style="cursor: pointer;" class="count_links highlight">5</a>
i want make top button have .new_button class when following met
.new_button { background-position: 0 -35px; text-decoration: none; color: #fff; }
there @ least 1 letter each of text fields , both industry_links , count_links classes have @ least 1 class highlight class
basically want change color of button when 5 met
sorry confusing
var allhaveatleastoneletter = true; $("input[type='text']").each(function(){ allhaveatleastoneletter && ($(this).val().length > 0 )}); var industrylinkshashighlight = $(".industry_links.highlight").length > 0; var countlinkshashighlight = $(".count_links.highlight").length > 0; if(allhaveatleastoneletter && industrylinkshashighlight && countlinkshashighlight){ $("proceed-btn.right").addclass("new_button"); }
Comments
Post a Comment