JQuery Selectors: Selecting the submit button but not the close button -


javascript:

<script> $('#submit').click(function () { $("p").show("slow"); }); </script> 

attempt two:

<script> $("input[type='submit']").click(function () { $("p").show("slow"); }); </script> 

html:

<form> username:<br> <input type="text" name="un"><br> password:<br> <input type="password" name="pw"><br> <input type="checkbox" name="pw"> remember me<br> <p><a href="recover.php">recover password</a></p> <p><input type="submit" value="submit" id="submit"></p> <p style="display: none; color:cc0000">authentication failed.</p> <p><button onclick="window.top.hidepopwin()">close</button></p> </form> 

am messing syntax on selectors here? submit button doesn't seem display hidden message using either method..

you need prevent submitting of form adding return false; end of click function, end of onclick button function since behaves submit button way set up.

so, this:

<script> $('#submit').click(function () {     $("p").show("slow");     return false; }); </script> 

see in action here.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -