Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
172 views
in Technique[技术] by (71.8m points)

jquery - Java Dynamic Web Project Spring MVC can't implement function from .js file

I use Java spring MVC framework and I want to implement a jQuery script function to hide 'p' bracket when I click a button.

A variant to the file my-query-page.jsp and jq_functions.js can be seen below

$(document).ready(function(){
    $("button").click(function(){
        $("p").hide();
    });
});
<!DOCTYPE html>
<html>
<head>
    <title>this is me learning jQuery</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>   
    
    <!--     THIS DOESN'T WORK        -->
    <script src="/resources/js/jq_functions.js"></script>
    
</head>
<body>
<h2> this is me learning jQuery</h2>
<p>this is a line of text</p>
<p>this is a second line of text</p>
<p>this is a third line of text</p>
 <button>Hide</button>
</body>
</html>
question from:https://stackoverflow.com/questions/65545876/java-dynamic-web-project-spring-mvc-cant-implement-function-from-js-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...