欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery點擊獲取動態(tài)數(shù)據(jù)進(jìn)行傳參問題

 更新時間:2022年12月01日 09:35:33   作者:qq_43711515  
這篇文章主要介紹了jquery點擊獲取動態(tài)數(shù)據(jù)進(jìn)行傳參問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

jquery點擊獲取動態(tài)數(shù)據(jù)進(jìn)行傳參

因為要點擊事件進(jìn)行跳轉(zhuǎn)頁面,將當(dāng)前頁面的部分?jǐn)?shù)據(jù)進(jìn)行傳參

$(".otd").click(function () {
? ? ? ? var _phone = $(this).prev()[0].innerHTML;
? ? ? ? sessionStorage.setItem("_phone",_phone);
? ? ? ? var _name=$(this).prevAll()[1].innerText;
? ? ? ? sessionStorage.setItem("_name",_name);
? ? }
);

jquery .click()方法傳參

今天寫東西,要在jQuery 的.click方法里傳參,查閱了一下jQuery的官方文檔,做了下實驗和總結(jié)(原諒我的前端 是用一點學(xué)一點!)

1.click()方法簡介

1.click( handler ) //1.0版本的.click,
? ? ? ? ? ? ? ? ? //handler(Function 類型),只要事件被觸發(fā),就會執(zhí)行該function
2.click( [eventData ], handler )//1.4.3版本加入的
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//參數(shù)eventData:可以為任何數(shù)據(jù)類型,保存在event.data中,event為handler的一個事件參數(shù)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//參數(shù)handler,為Function類型,例:function(event){}

2.寫段代碼測試一下

<html>
? <head>
? ? <title></title>
? ? <meta content="">
? ? <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
? ? <script>
? ? ? $(document).ready(function(){
? ? ? ?$("#btn").click("測試數(shù)據(jù)",function(event){
? ? ? ? ?alert(event.data);
? ? ? ?})
? ? ? });
</script>
? ? <style></style>
? </head>
? <body>
? ? <button type="button" id="btn">click</button>
? </body>
</html>

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論