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