Ask questionsMethod scrollLeft not registered

In, if I add the following code to the HTML segment of the page:

<script type="text/javascript">
 function scrollLeft() {
 function scrollRight() {

<div class="content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<button onclick="scrollLeft()">
<button onclick="scrollRight()">

I get the following error when clicking the left button:

?editor_console=true:113 Uncaught TypeError: scrollLeft is not a function
    at HTMLButtonElement.onclick (?editor_console=true:113)
onclick @ ?editor_console=true:113

This is kinda weird. If I rename 'scrollLeft' to 'left' for example then the function works. Apparently there's a bug somewhere internally in JSFiddle where it doesn't allow that specific function to be registered.


Answer questions oskarkrawczyk

You're trying to overwrite a native method:

Closing. Not a JSFiddle issue.


Related questions

No questions were found.
Github User Rank List