Home > front end >  Alert () why not pop-up warning box?
Alert () why not pop-up warning box?

Time:12-11



<meta charset="utf-8" & gt;
Sharp jQuery
<link rel="stylesheet" href="https://bbs.csdn.net/topics/css/default.css" type="text/CSS"/& gt;
<link rel="stylesheet" href="https://bbs.csdn.net/topics/css/ceshi.css" type="text/CSS"/& gt;
<script SRC="https://bbs.csdn.net/topics/js/jquery.js" & gt; </script>


<style type="text/CSS" & gt;
. Highlight {
Background: # FF3300;
}
</style>




<script SRC="https://bbs.csdn.net/topics/js/jquery.js" & gt;
$(function () {
The function xianshi () {
Alert (" hello word!" )
};
}
</script>

CodePudding user response:

Native JS can't write in JQ!!

CodePudding user response:

Many wrong
1, form form button to write the type is equal to the button, or you will submit to submit
2, the script code block write SRC do?
3, inside the $() function, direct use dom is not enough, can look at the scope related document
()=& gt; {} is equal to the function () {} specific see es6

 






<script>
Let xianshi
$(function () {
Xianshi ()==& gt; {
Alert (" hello word!" )
};
})
</script>

CodePudding user response:

4, the script code block $() missing right parenthesis

CodePudding user response:

The scope of the function definition is wrong, you put the function xianshi () written in jq load function, xianshi function button click event recognition is less than, you have to write the most outer layer

CodePudding user response:

I see can't write in script code block links, otherwise the code in the block of code is invalid

CodePudding user response:

How do you can refer to external js script code block add js logic,
Solution
1. Write a js file, put the logic in, and then reference to the current file
2. In the current page, reference js file after add script code block, logically filled in

CodePudding user response:

reference 1st floor yuqiz1981 response:
native JS can't write in JQ!! Why can't
mix can be written
  • Related