0

我在 jQuery 中使用.showand时遇到问题。.hide基本上,一旦您按下注册按钮,我希望出现两个选项,这是代码:

HTML

<div id='register'>
    <form>
        <input type='button' class='register-button' name='register-button' value='R e g i s t e r !'>
    </form>
    <form id='register-type'>
        <span class='register-type-background'> </span>
        <input type='button' class='register-type-band' name='register-type-band' value='Band'>
        <input type='button' class='register-type-user' name='register-type-user' value='User'>
    </form>
</div>

查询:

$(document).ready(function(){
$('#register-type').hide();
$('.register-button').click(function(){
    $('#register-type').show();
   });
});

还有更多 HTML:

<head>
<title> Title </title>
<link rel='stylesheet' href='stylesheet.css' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script>
<script type='script' src='javascript.js'> </script>
</head>
4

1 回答 1

2

你的代码很好,但你的问题是你的实际script参考:

<script type='script' src='javascript.js'> </script>

没有type='script,必须是type='text/javascript',改成:

<script type='text/javascript' src='javascript.js'> </script>
于 2013-09-03T21:35:14.927 回答