Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <style> p { width: 1000px; } </style> <script> $(document).ready(function () { $("button").click(function () { $('#mydiv').scrollLeft(300); //alert("the scrollleft of div tag is " + $('div#mydiv').scrollLeft()); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: scrollLeft()</h1> <div id="mydiv" style="background-color: aquamarine;height:250px;overflow:auto"> <p>This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery. This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery. This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery. This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.This is jQuery.</p> </div> <button>Click Here to Test .scrollLeft()</button> </body> </html>
Result: