请告诉我如何使用php
按下按钮时更改data-href
的值
<div class="fb-send" data-href="http://wishindia.in/wishindia/Diwali/index.php?name=Ram&message=Jai+Shri+Ram"></div>
<div class="fb-share-button" data-href="http://wishindia.in/wishindia/Diwali/index.php?name=Mk&message=Share+button" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwishindia.in%2Fwishindia%2FDiwali%2Findex.php%3Fname%3DMk%26message%3DShare%2Bbutton&src=sdkpreparse">Share</a></div>
分享Whatsaps
<div id="mobile-share">
<a href="whatsapp://send?text=http://wishindia.in/wishindia/Diwali/index.php?name=asdfa&message=asdfadf" data-action="share/whatsapp/share">Share on Whatsaps</a>
</div>
buttton
<a href="#" class="newwish" data-toggle="modal" data-target="#myModal">Send</a>
答案 0 :(得分:0)
正如Mike X和Naltroc所说,你可以使用jQuery来做,这是一个示例代码:
$(".fb-send").click(function(event){
event.preventDefault();// this will stop redirecting to other page
$(this).attr("href", "https://www.google.com");
});
答案 1 :(得分:0)
<p><a href="https://www.w3schools.com" id="w3s">W3Schools.com</a></p>
<button>Change href Value</button>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#w3s").attr("href", window.location.href);
});
});
</script>
最后我得到了我的答案window.location.href,其中一些jquery完成了这项工作。