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
1 Answer
Reset to default 5This 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
评论列表(0条)