如果我有:jQuery的鏈接自定義函數
function printRangeValue(){
$(this).prev().children("output").text($(this).val());
}
$(document).ready(function(){
//...
$("#strStat").printRangeValue();
$("#conStat").printRangeValue();
});
<label for="strStat">Strength<output id="forStr" for="strStat">12</output></label>
<input type="range" id="strStat" class="stat" name="strStat" min="3" max="20">
有一個簡單的方法來改變準備功能的內容,使$(this)
工作?
謝謝!
您是否在尋找'jQuery.fn.printRangeValue =函數(){...}'?或者是其他東西?這有點難以分辨,因爲你的問題是關於「鏈接」的問題,但你實際上並沒有進行任何鏈接。你的代碼不會像書面的那樣工作,但你並沒有提到完全失敗,所以很難確定你想要什麼。 – apsillers
你想[創建你自己的插件](https://learn.jquery.com/plugins/basic-plugin-creation/)。 – moonwave99
好吧,你需要2個或更多的功能稱之爲連鎖?如果是這樣,那麼我肯定是錯誤的鏈接,那裏沒有任何失敗者,它只是沒有工作。 – user5489152