如何动态地将参数传递给javascript方法 [英] How to pass parameters to javascript method dynamically
问题描述
我有一个显示通知的javascript函数
( function (){
$(' 。demo-1')。on( ' 点击',功能(e) {
e.preventDefault();
$ .notify(' 我是一个警告框。 ');
});
})(jQuery);
我尝试了什么:
我想将动态值传递给它,为此,我已按如下方式自定义上述代码:
( function ShowNotification(message){
$ .notify(消息);
})(jQuery);
Javascript代码不起作用,任何人都可以帮我解决这个问题吗?
谢谢
(' < span class =code-string>。demo-1')。on(' click', function (e){
e.preventDefault();
.notify(' 我是一个警报框。');
});
})(jQuery);
我尝试过:
我想将动态值传递给它,为此,我已按照以下方式自定义上述代码:
< pre lang =Javascript>( function ShowNotification(message){
.notify(message);
} )(jQuery);
Javascript代码无效,任何人都可以帮我解决这个问题吗?
谢谢
I have got a javascript function which displays the notification
(function () {
$('.demo-1').on('click', function (e) {
e.preventDefault();
$.notify('I am a alert box.');
});
})(jQuery);
What I have tried:
I want to pass dynamic values to it and for that, I've customized the above code as follows:
(function ShowNotification(message) {
$.notify(message);
})(jQuery);
Javascript code is not working, can anyone help me fix this issue?
Thanks
('.demo-1').on('click', function (e) { e.preventDefault();
.notify('I am a alert box.'); }); })(jQuery);
What I have tried:
I want to pass dynamic values to it and for that, I've customized the above code as follows:
(function ShowNotification(message) {
.notify(message); })(jQuery);
Javascript code is not working, can anyone help me fix this issue?
Thanks
这篇关于如何动态地将参数传递给javascript方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!