Form onsubmit not triggered by inlined javascript -


my issue comes when click on button, form submitted fine, inlined onsubmit event not called, confirmation alert never printed.

my code:

<!-- delete button --> <a onclick="document.getelementbyid('delete-form-`+ data.id +`').submit();" class="icon">     <i class="mdi mdi-delete"></i> </a>  <!-- hidden form --> <form id="delete-form-`+ data.id +`" action="`+ 'posts/'+ data.id +`"     style="display: none;"      onsubmit="return confirm('are sure want perform action?');">     {{ method_field('delete') }}     {{ csrf_field() }} </form> 

i don't know if meant happen, there reason? keep inlined, have solution?

edit: may have noticed quotes i'm using piece of code being inserted in dom using javascript, thought it's worth mention.

thank in advance.

i'm not sure can use more 1 id same element , + separate them

<form id="delete-form-`+ data.id +`" 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -