Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <style type="text/css"> div{ border:1px solid black; width:200px; overflow:auto; } </style> </head> <body> <div>TàiLiệuHướngDẫnHọcLậpTrìnhWebTừCơBảnĐếnNângCao</div> <br> <button type="button">Click here</button> <script> $(document).ready(function(){ $("button").click(function(){ var position = $("div").scrollLeft(); alert(position); }); }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <style type="text/css"> div{ border:1px solid black; width:200px; overflow:auto; } </style> </head> <body> <div>TàiLiệuHướngDẫnHọcLậpTrìnhWebTừCơBảnĐếnNângCao</div> <br> <button type="button">Click here</button> <script> $(document).ready(function(){ $("button").click(function(){ var position = $("div").scrollLeft(); alert(position); }); }); </script> </body> </html>