我想提醒你好,而不是我收到 [object Object]。使用 jquery 將 php 字符串傳遞給 onclick 函數(shù)來獲取 [object Object]<!DOCTYPE html><html><body><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><p id="demo"></p><a class="readmore" onclick="myFunction('<?php echo "hello";?>')">Readmore....</a><?phpcall();function call(){?><script>$(document).ready(function(){ $(".readmore").click(function(link){ alert(link); });}); </script><?php }?></body></html>
1 回答

手掌心
TA貢獻(xiàn)1942條經(jīng)驗 獲得超3個贊
我想提醒你好,而不是我收到 [object Object]。使用 jquery 將 php 字符串傳遞給 onclick 函數(shù)來獲取 [object Object]
<!DOCTYPE html>
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<p id="demo"></p>
<a class="readmore" onclick="myFunction('<?php echo "hello";?>')">Readmore....</a>
<?php
call();
function call(){
?>
<script>
$(document).ready(function(){
$(".readmore").click(function(link){
alert(link);
});
});
</script>
<?php }
?>
</body>
</html>
- 1 回答
- 0 關(guān)注
- 86 瀏覽
添加回答
舉報
0/150
提交
取消