I have a problem with single quote ('
):
<button type="button" class="tasto btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"
onclick="myFunction('[blkfeatured.lastname]')">
If lastname = "Mario Rossi"
, this works, but
If lastname = "Stefano d'Orazio"
, it doesn't work, because I've created another '
, and then
I have syntax error.
Look this example (please copy and try it):
<button type="button" onclick="nominativo = 'Mario Rossi'; myFunction(nominativo)">
<span>Vedi informazioni</span>
</button>
<script type='text/javascript'>
function myFunction(nominativo) {
alert(nominativo);
iframe.src = 'nomesito.php?nome=' + nominativo;
}
</script>
Now... if you try this program WORK, but if you change lastname: "nominativo = 'Stefano d'Orazio' don't work.
Can you help me?