weixin_33690963 2011-07-23 14:24 采纳率: 0%
浏览 22

jQuery插入ajax内容

This function inserts a file upload field in a specific div

$(".add_file_field").click(function() {
    var qid = $(this).attr("rel");
    $(this).parent().before("<div id='p_holder'></div>");
    $("#p_holder").load("<?=site_url('survey/add_upload_field')?>", {
        'qid': qid 
    });
    return false;
});

It is triggered by clicking on the link in this snippet

<span class="add_field_wrap">
    <a rel="31" class="add_file_field" href="http://domain.com/kms/#">
        Add another file
    </a>
</span>

How can I get it to insert the content just before the span.add_field.wrap, ie. without specifying a specific container that will receive the content? The span and all other markup must stay in place; the point is that the user can add as many file upload fields as he wants.

Thanks

  • 写回答

4条回答 默认 最新

  • weixin_33711647 2011-07-23 14:29
    关注

    Is this what you want?

    $('.add_field_wrap').before(required_html_content);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 手机连接电脑热点显示无ip分配
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大