javascript - How to use Notify.js with button? - Stack Overflow

Ive downloaded Notify.js'files and put them in root of webpage. im trying to test it but i didn�

Ive downloaded Notify.js'files and put them in root of webpage. im trying to test it but i didn't get anything when click on button

<html>

<head>
<title>Untitled</title>
<script src="notify.js"></script>
</head>

<body>
<input name="notif" type="button" value="Shoow notif" onclick="$(".elem-demo").notify("Hello Box");">
</body>

</html>

Whats the problem?

Ive downloaded Notify.js'files and put them in root of webpage. im trying to test it but i didn't get anything when click on button

<html>

<head>
<title>Untitled</title>
<script src="notify.js"></script>
</head>

<body>
<input name="notif" type="button" value="Shoow notif" onclick="$(".elem-demo").notify("Hello Box");">
</body>

</html>

Whats the problem?

Share Improve this question asked Aug 30, 2014 at 11:33 Edd HakobyanEdd Hakobyan 411 gold badge2 silver badges5 bronze badges 3
  • 2 How about loading jQuery? – Ram Commented Aug 30, 2014 at 11:37
  • 1 Do you mean this? <script src="ajax.googleapis./ajax/libs/jquery/1.8.1/…> – Edd Hakobyan Commented Aug 30, 2014 at 11:46
  • @undefined This is the Answer stackoverflow./a/25582016/3176270 – Mohammad Kermani Commented Aug 30, 2014 at 11:53
Add a ment  | 

1 Answer 1

Reset to default 5

This is your answer and working:

<html>
<head>
<title>Untitled</title>
<script src="http://ajax.googleapis./ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="notify.js"></script>
</head>

<body>
<input name="notif" type="button" value="Shoow notif" onclick="$('.elem-demo').notify('Hello Box');"/>

<div class="elem-demo">a Box</div>
</body>

</html>

1-You forgot to include jquery to your file.

2-You should create an element that has a elem-demo class

3-Your javascript had a problem! You can't use double-quotation and it's child has double-quotation too.

here is your code example, and then my code:

onclick="$(".elem-demo").notify("Hello Box");"  //Your code

onclick="$('.elem-demo').notify('Hello Box');"  //My code

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742380713a4433058.html

相关推荐

  • javascript - How to use Notify.js with button? - Stack Overflow

    Ive downloaded Notify.js'files and put them in root of webpage. im trying to test it but i didn�

    18小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信