html <!DOCTYPE html> <html> <head> <title>JQuery Demo</title> <script src="jquery.min.js"></script> <script src="script.js"></script> <style> .selected { background-color: yellow; } </style> </head> <body> <div id="myDiv">Hello, JQuery!</div> <button id="myButton">Change Style</button> </body> </html> script $(document).ready(function() { $('#myButton').click(function() { $('#myDiv').addClass('selected'); }); });


上一篇:
下一篇:
切换中文