Sedition·code

Fuck yeah jQuery #1

Sunday, 18 November 2012—subject to ongoing, unnanounced updates

Modern Perl Modern Perl at Powell’s, Modern Perl at Barnes and Noble, Modern Perl at Amazon.com, or download Modern Perl for free and then recommend it to your friends, write a great review, or otherwise spread the word.

Clear a form with the reset button.

<script type="text/javascript">
jQuery(function($){
  $("input[type=reset]").click(function(){
     $(this).closest("form")
            .find("input")
            .not(":button, :submit, :reset, :hidden")
            .val("")
            .removeAttr("checked")
            .removeAttr("selected");
     return false;
  });
});
</script>

Needs citation… I cannot remember where I picked most/all of this up. HURR.

Modernized… maybe. Haven’t tested yet.

<script type="text/javascript">
jQuery(function($){
  $("input[type=reset]").click(function(){
     $(this).closest("form")
            .find("input")
            .not(":button, :submit, :reset, :hidden")
            .val("")
            .prop("checked",false)
            .prop("selected",false)
            .prop("defaultValue","");
     return false;
  });
});
</script>

Needs citation… I cannot remember where I picked most/all of this up. HURR.