OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Can displaying an alert within an i html tag click event

  • Thread starter Thread starter KubiRoazhon
  • Start date Start date
K

KubiRoazhon

Guest
I'm trying to make a photo upload in PHP, CSS and JavaScript. When I select the photos that I should upload from the multiple file selector I display them, I try to display every image with a close red icon illustrated by an <i> tag element delivered by Font-awesome.

Code:
<li>
  <i class="fa fa-times fa-2x close_photo" style="color: red" id="delete"></i>
  <img src="">
</li>

Here's an image to illustrate the situation:

enter image description here

The problem is when I try to click this element to delete the picture, there's no reaction after my action. I've tried so many JavaScript solutions:

Code:
$('#delete').on('click',function(){
    alert('OK');
});

$('#delete').click(function(){
    alert('OK');
});

$(this).trigger('click',function(){
   alert('OK');
});

So any one to help?
<p>I'm trying to make a photo upload in PHP, CSS and JavaScript. When I select the photos that I should upload from the multiple file selector I display them, I try to display every image with a close red icon illustrated by an <code><i></code> tag element delivered by Font-awesome.</p>
<pre><code><li>
<i class="fa fa-times fa-2x close_photo" style="color: red" id="delete"></i>
<img src="">
</li>
</code></pre>
<p>Here's an image to illustrate the situation:</p>
<p><a href="https://i.sstatic.net/3ubno.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3ubno.png" alt="enter image description here" /></a></p>
<p>The problem is when I try to click this element to delete the picture, there's no reaction after my action. I've tried so many JavaScript solutions:</p>
<pre><code>$('#delete').on('click',function(){
alert('OK');
});

$('#delete').click(function(){
alert('OK');
});

$(this).trigger('click',function(){
alert('OK');
});
</code></pre>
<p>So any one to help?</p>
Continue reading...
 
Top