这就是我要找的东西:-)它现在正在运行,但我对整个代码都不了解。例如,与参数[0] ||对齐{} ...
$.fn.myPlugin = function() {
// extend the options from pre-defined values:
var options = $.extend({
callback: function() {},
input: "",
url: ""
}, arguments[0] || {});
// call the callback and apply the scope:
$(document).on("keyup", options.input, function(){
options.callback.call(this);
});
};
$('#test_input').myPlugin({
callback: function() {
console.log($(this).val() );
},
input: "#test_input",
url: "example.php"
});
</script>
<?php
echo "<input type=text id=test_input maxlength=50 size=25>";
echo "<div id=test_obsah></div>";
答案 0 :(得分:1)
这只会添加android.content.ActivityNotFoundException: Unable to find explicit activity class {com.geekybrackets.virtualtourguide/com.geekybrackets.virtualtourguide.EditMarkerActivity}; have you declared this activity in your AndroidManifest.xml?
个事件。
keyup
这一个,你可以添加任何事件......
$.fn.Example = function(fn) {
$(document).on("keyup", this, fn);
};
$(document).ready(function(){
$("#test_input").Example(function() {
// myfunction, when keyup event is triggered in #test_input
});
});
Jquery扩展中的$.fn.Example = function(input) {
$(document).on(input.event, this, input.fn);
};
$(document).ready(function(){
$("#test_input").Example({
fn: function() {
// myfunction, when keyup event is triggered in #test_input
},
event: "keyup"
});
});
关键字指向this
dom元素。
<强>更新强>
这将接受多个事件......
#test_input