Jquery 显示隐藏div&;在焦点输入上使用淡入淡出关闭

Jquery 显示隐藏div&;在焦点输入上使用淡入淡出关闭,jquery,Jquery,嗨,我用这段代码显示输入焦点上的隐藏div 这是html,请看一下@也 请帮帮我,它不起作用 $(document).ready(function() { $('.url_field').focus(function() { //$(this).next(".showdiv").fadout('slow').css('display', 'inline'); not sure what this does so commented it out $('

嗨,我用这段代码显示输入焦点上的隐藏div

这是html,请看一下@也

请帮帮我,它不起作用

$(document).ready(function() {

    $('.url_field').focus(function() {
        //$(this).next(".showdiv").fadout('slow').css('display', 'inline');  not sure what this does so commented it out
        $('.content').hide();
        $('#' + $(this).attr('rel')).show(); // you also don't have a rel on the input so this won't do anything
        return false;
    });

    $('.content input.close').click(function() {
        $(this).parent().hide();
    });
});

此外,您可能希望css以显示块开始,除非您先隐藏它们,然后再显示它们-但是您需要在输入中添加rel=“last”或rel=“first”

在淡出中使用“e”,否?)没有元素“.showdiv”使用浏览器的-javascript控制台查看错误。有很多…它的
fadeout('slow')
不是
fadeout('slow')
我编辑的,请看一看小问题,它在这里工作得很好,但在这里它只显示了一次hide div。
$(document).ready(function() {
    $(".url_field").focus(function() {
        $(this).next(".content").fadeout('slow').css('display', 'inline');
    });

    $('.url_field').focus(function() {
        $('.content').hide();
        $('#' + this.rel + '').show();
        return false;
    });
    $('.content input.close').click(function() {
        $(this).parent().hide();
    });
});
$(document).ready(function() {

    $('.url_field').focus(function() {
        //$(this).next(".showdiv").fadout('slow').css('display', 'inline');  not sure what this does so commented it out
        $('.content').hide();
        $('#' + $(this).attr('rel')).show(); // you also don't have a rel on the input so this won't do anything
        return false;
    });

    $('.content input.close').click(function() {
        $(this).parent().hide();
    });
});