Created
June 14, 2011 16:15
-
-
Save NickClark/1025240 to your computer and use it in GitHub Desktop.
How do you create a jquery plugin that needs to keep state?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.toggle_field_on_select_value = function(select_input, value) { | |
toggle = function (){ | |
$select = $(select_input); | |
$this = $(this); | |
if($select.attr("value") == value){ | |
$this.slideDown(); | |
}else{ | |
$this.slideUp(); | |
} | |
} | |
toggle(); | |
$this.change(toggle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment