'Event click not working. can you solve it for me
How to delete an element when I click it
HTML
<span id="portoDeleteFIle_${id}" class="deleteFile" title="Delete">+</span>
//${id} is number and < 99
JS
<script type="text/javascript">
jQuery("span[id^='portoDeleteFIle_']").click(function(e) {
id = e.currentTarget.attributes.id.value.replace("portoDeleteFIle_", "");
console.log(id);
});
</script>
Solution 1:[1]
Try this:
jQuery("span[id^='portoDeleteFIle_']").click(function(e) {
id = e.currentTarget.attributes.id.value.replace("portoDeleteFIle_", "");
console.log(id);
});
There was missing ) in your code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arif Khan |
