Created
August 2, 2011 20:33
-
-
Save AJFaraday/1121153 to your computer and use it in GitHub Desktop.
jquery hiding/showing feild
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
# my jquery specifics (jq_actions.js) | |
var $j = jQuery.noConflict(); | |
var $extra_kinds = 'of <input id="indicator_number_name" name="indicator[number_name]" size="15" type="text" />' | |
$j(document).ready(function(){ | |
$j("#kinds").change(function(){ | |
var $value = $j('#indicator_kind').val(); | |
if ($value == "number") | |
{ | |
$j('#extra').html($extra_kinds); | |
} | |
else | |
{ | |
$j('#extra').html(''); | |
} | |
}); | |
}); | |
# in my view | |
<td id='kinds'><%= f.select :kind, options_for_select(['number', 'time', 'achieved']), :id => "test" %><div id="extra" /></td> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment