如何在iframe中获取onclicked div的内部html?

时间:2015-03-16 06:32:48

标签: php jquery html css iframe

我尝试使用下面的代码,但它没有获取被点击的当前类实例。而不是它显示他在我的iframe中找到的第一类内容。

$(document).ready(function(){
    $('#framedata').load(function(){
        var iframe = $('#framedata').contents();

        iframe.find(".editContent").click(function(){
            $("#spanid").show();

            var content_edit = iframe.find(".editContent").html();
            //alert(content_edit);
            //var content_edit = x.contentWindow.documentgetElementByClass('editContent').innerHTML;
            $("#spanid").append("<textarea id='editor'>"+content_edit+"</textarea>"); 
        });
        //...etc...
    });
});

提前感谢你

0 个答案:

没有答案