Demo sử dụng get html()
RUN
<!DOCTYPE html> <html> <head> <title>Đổi màu nhé</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script language="javascript" src="http://code.jquery.com/jquery-2.0.0.min.js"></script> <script language="javascript"> $(document).ready(function(){ $('#button').click(function(){ var content = $('#content').html(); alert(content); }); }); </script> </head> <body> <div id="content"> <h1>Nội dung nè</h1> </div> <input type="button" value="Lấy nội dung bên trong" id="button"/> </body> </html>
PHÓNG TO