开发者

show/hide div jquery

开发者 https://www.devze.com 2023-02-09 18:27 出处:网络
I am keeping having errors from the below code: <input type=\"button\" id=\"test\" name=\"test\" onclick=\"test();\" value=\"Test\"/>

I am keeping having errors from the below code:

<input type="button" id="test" name="test" onclick="test();" value="Test"/>
function test(){
    $('#divUser').hide('fast');
    $('#divAddress').hide('fast');
    $('#divDetails').show();

}

or

        $('#test').click(function () {
            $('#Div3').show();
            $('#Div1').hide('fast');
       开发者_Python百科     $('#Div2').hide('fast');
            return false;
        });

on jsFiddle: http://jsfiddle.net/mohamad/rFhM6/

it is solved: i replaced this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>

with

 <script src="/jscripts/jquery-1.2.6.pack.js" type="text/javascript"></script>


Your code seems correct, except that your JavaScript function is not wrapped in a <script> tag (as pointed by ILMV in your comment):

<input type="button" id="test" name="test" onclick="test();" value="Test"/>
<script type="text/javascript">
function test(){
    $('#divUser').hide('fast');
    $('#divAddress').hide('fast');
    $('#divDetails').show();
}
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消