I have a ..weird problem.
I have this function JavaScript:
function example() {
alert('a');
}
And i have this 2 inputs:
This does NOT work
<input type="image" src="img/erase.png" alt="Borrar" onclick="example();">
this WORKS
<input type="image" src="img/erase.png" alt="Borrar" onclick="alert('a');">
I know they do the SAME but in me real project i want create with PHP bucle a items and they should call JavaScript.
This example is for understan easy this problem.
Thank you ppl! :D
Solution:
In mi code in PHP i write bad the "echo" and put a lot of " and ', and when i go to write the parameters can write ' or " because they are used to write and describe the "echo" (PHP) and then i should write ""
".
example:
echo "<input type='image' src='img/erase.png' alt='Borrar' onClick='borrarPost("NOTICIA","".$row['Titulo']."",".$row["ID"].")'>";
the "
is for a parameters String, normal echo is like echo "Hi"
but this who write a input need use ",' and "