You are viewing limited content. For full access, please sign in.

Question

Question

E-Forms File upload deletion

asked on August 5, 2016 Show version history

Hi All,

I am trying to increment and decrement a counter according to the number of file uploaded in a form using JS Code and the E-form. But the problem is that i cannot access the delete button next to the files name to put a listener or trigger on it.

the code is as follows (for the increment only)

var Doc_Count ;


$(document).ready(function(){
  Doc_Count = $("#Field12").val();
  
    $("#Field10").change(function(e){
            Doc_Count++;
    $("#Field12").val(Doc_Count);
     });

  
  });

 

#field10 is the file upload button from the form and #field12 is the hidden field 

how can i access the delete button from my code ?? 

 

please advice.

 

Thank you

0 0

Answer

SELECTED ANSWER
replied on August 5, 2016

Hi Maher,

This script will solve your issue. I assume that #q10 is the id of the file upload

var Doc_Count;

$('#q10').bind('DOMSubtreeModified', function(e) {
  if (e.target.innerHTML.length > 0) {
    // Content change handler
     Doc_Count = $('#q10 .file-del').length;
  }

 

0 0
replied on August 5, 2016

Thanks a lot Xavier, the code did helped but with modification. I used the ".length. function on the submit button of the form .Thanks a lot for your Help

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.