Мне нужна помощь, чтобы кнопка Якоря не была нажата после того, как она была нажата один раз раньше.Отключить якорные кнопки
Любая помощь будет оценена заранее спасибо
HTML КОД:
<div class="text-center">
<a role="button" class="btn btn-success" id="createGameButton" onclick="addGame();">Create Coinflip</a>
</div>
JAVASCRIPT КОД:
function addGame()
{
var side = $("#side").val();
var steamid = $("#steamid").val();
var amount = $("#amount").val();
var buttonText = document.getElementById('createGameButton').innerHTML;
if(buttonText=='Create Coinflip')
{
$.ajax(
{
url: 'addGame.php',
type: 'POST',
data: 'side=' + side + '&steamid=' + steamid + '&amount=' + amount,
dataType: 'text',
success: function (data)
{
document.getElementById('game-alert').innerHTML = data;
$("#game-alert").fadeIn();
refreshGames();
document.getElementById('createGameButton').innerHTML = 'Create Coinflip';
}
});
}
}
что вы пробовали? – goto
Используйте jQuery для регистрации обработчика, который будет вызываться только один раз –
@goto Я устал от ряда вещей, таких как $ ("# anchorid"). Off ('click'); –