1
In the HTML of the page I’m adjusting, it contains several links with a function in the onClick
:
<a href='#' onClick='funcao(100)'>Link</a>
and the current Javascript is like this:
<script>
function funcao(numero) {
$.ajax({
type: 'POST',
url: "url-checka-numero/",
data: { numero: numero },
success: function(data) {
$('.return').html(data);
}
});
}
</script>
I tried to disable the onClick
of the element <a>
by clicking on it:
<script>
function funcao(numero) {
$(this).removeAttr('onClick');
$.ajax({
type: 'POST',
url: "url-checka-numero/",
data: { numero: numero },
success: function(data) {
$('.return').html(data);
}
});
}
</script>
The intention is to exclude only the onClick
of the elements <a>
containing the onclick='funcao(n)'
, and not the others, but what I did removes everything.
Thank you for your wisdom, I will test too, another way of doing will help for other adjustments I’ve seen.
– ElvisP