Why this function javascript not alert? -
why function javascript not alert ?
first , click click 1
it's show delete
, click delete
why not alert 111-aaaa
how can that?
https://jsfiddle.net/tdpusq05/
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div onclick="test_fn1()">click 1</div> <div id="demo"></div> <script> function test_fn1() { document.getelementbyid("demo").innerhtml = "<span onclick='delete_fn('111-aaaa')'>delete</span>"; }; </script> <script> function delete_fn(no_delete) { alert(no_delete); }; </script>
remove single quotes onclick
around delete_fn('111-aaaa')
following
function test_fn1() { document.getelementbyid("demo").innerhtml = "<span onclick=delete_fn('111-aaaa')>delete</span>"; };
Comments
Post a Comment