I'm trying to pass a value through a input type hidden
of the HTML generated in PHP to JavaScript, however this variable in JavaScript is like Undefined. What can it be?
PHP
<form name='form5' method='post'>
<input type='hidden' name='id-playlist' value='$consulta[id_playlist]'>
<input type='image' id='carregar-playlist' src='images/play-circle-24.png' alt='Botao'>
</form>
JavaScript
$(document).ready(function(){
$(document).on('click', '#carregar-playlist', function () {
id_playlist=$("#id-playlist").val();
alert(id_playlist);
});