我想创建一个简单的设置,以便当某个代码输入到表单框中时,然后显示一个隐藏的元素。如果你能帮助我,那会很棒。谢谢!密码来显示内容
<form>
Enter the passcode to see the content:
<input id="pwd" type="text" name="pwd" />
</form>
<div id="content" style="display:none;">
testing 123
</div>
<script>
$function(){
$(form).keyup(function() {
$('input').trigger('change');
});
if ($('pwd').val() == supportingcauses){
$('content').show('slow');
}
};
</script>
http://jsfiddle.net/jaruesink/RTG4f/
这里有什么问题? – helloandre
这不是最好的主意,因为任何人以HTML格式查看您的HTML页面将能够看到您的隐藏内容......所以没有真正的理由来保护它的密码... – Nayish
它看起来nayish建议服务器之旅,你可以用AJAX做。 – mozillanerd