I'm trying to link this button with #analyzebutton
id
<div class="pd-upload-foto">
<div class="vertical-center text-center">
<button id="startbutton" class='btn btn-ambilfoto btn-sm btn-1 font-3' style='padding-top:.2rem; padding-bottom:.2rem;' type='button'>ambil foto</button>
<button id="analyzebutton" class='btn btn-sm btn-1 font-3' style='padding-top:.2rem; padding-bottom:.2rem; display: none;' type='button'>mulai analisis</button>
</div>
</div>
<div class="pd-analisa" style="display: none;">
<div class="vertical-center text-center">
<button id="analyzingbutton" class='btn btn-sm btn-1 font-3' style='padding-top:.2rem; padding-bottom:.2rem;' type='button'>mulai analisa</button>
<img id="tesfotomasuk" src="" alt="tes aja">
</div>
</div>
with this JQuery script
$(".btn-ambilfoto").click(function() {
$(".btn-ambilfoto").html("berhasil").attr("disabled", "true");
$(".btn-ambilfoto").removeClass("btn-1").addClass("btn-4");
$("#analyzebutton").show();
});
$("#analyzebutton").click(function() {
$(".pd-upload-foto").hide();
$(".pd-analisa").show();
$("#analyzingbutton").html("Analyzing...");
});
When I press the #analyzebutton
button, it should fire the on click function and executes the function, but it doesn't. It's
I also have linked the JQuery script and the JS script at bottom of the html file.
Somehow, #analyzebutton
is the only that doesn't work. The .btn-ambilfoto
button (located just above the #analyzebutton
) works without problem.
I've tried to change the code to $(selector).on("click", function(){})
but it doesn't work either.
How should I fix this? I've spent more than 6 hours to just to fix this.