javascript - dynamic change of style on form condition via jquery -
trying set change of style via jquery on condition form entry right can't make work. here fiddle
<div id="protectimages"> image library password <input class="libaccess" type="password" name="pwd"></input> <a class="libenter" href="#">enter</a> </div>
and jquery
$(document).ready(function(){ $("libenter").click(function(){ if ( $(".libaccess").val() != test ) { $(".protectimages").css('background-color','f6f6f6'); } }); });
where mistake?
edited comments bellow. here fiddle http://jsfiddle.net/soloveich/lvxb2/2/
put code in <head> :- <head> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script> $(document).ready(function(){ $(".libenter").click(function(){ if ( $(".libaccess").val() != "test" ) { $("#protectimages").css('background-color','#f6f6f6'); } }); }); </script> </head> missed call click event class ".libenter". 1 more thing "test" should in string form.
also use id of div "#protectimages". have not provided reference of jquery library. without using jquery library can not use $.
Comments
Post a Comment