Why is not working in javascript?

This is my Javascript:


And here is my site:

http://www.andrewjalexander.com/

Why is not working in javascript?

asked Nov 28, 2011 at 1:48

4

It's document.getElementById, not document.getElementbyId. (In JS, name of variables and functions are case-sensitive)

Debugging tip : Look at the JS console (F12 in Google Chrome and IE9, Ctrl+Shift+K in Firefox). In this case, following error can be seen:

Why is not working in javascript?

It shows where the error happened (line 260 in your HTML/JS code) and what the error is(Object # has no method getElementbyId).

answered Nov 28, 2011 at 1:52

JiminPJiminP

2,09619 silver badges26 bronze badges

0

It's getElementById, not getElementbyId. Note the upper case "B".

hammar

137k17 gold badges298 silver badges383 bronze badges

answered Nov 28, 2011 at 1:52

CitoCito

5,05727 silver badges29 bronze badges

You're going to hate yourself for this, but you put getElementbyId() instead of getElementById(). Note the capitalized "B" in the second version.

answered Nov 28, 2011 at 1:53

chess007chess007

8266 silver badges7 bronze badges

Its getElementById in place of getElementbyId

answered Jun 27, 2017 at 16:24

Amaan IqbalAmaan Iqbal

7312 gold badges9 silver badges25 bronze badges

Try to hide then show a element on scroll I had to go this route. Basically i tried to use window so I used 'body'

$(document).ready(function() {

$('body').scroll(function() {
 var scroll = $('body').scrollTop();
 if (scroll <= 50 ) {
     console.log(scroll);
   we
    } else {
    $("#label").css('fill', 'none');
    $(".label").addClass(".transition");
 }
 if (scroll <= 150) {
    $(".sizeLG").css('color', '#ffffff');
 } else {
    $(".sizeLG").css('color', '#00000000');
    $(".sizeLG").addClass(".transition");
 }
});

});

answered Aug 29, 2018 at 8:30

Why is not working in javascript?

Make sure your id or class you used in html code will accordingly .(dot) Or #(hash) with their name.

Ex:

   For id:
   html:

  
****Some code**** <\div> Javascript: var VariableName = document.querySelector( "#idName"); Or var VariableName = document.getElementById( "#idName"); For class: html:
****Some code**** <\div> Javascript var VariableName = document.querySelector( ".className"); Or var VariableName = document.getElementById( ".className");

answered Jun 23, 2021 at 17:44

Not the answer you're looking for? Browse other questions tagged javascript html or ask your own question.

Why my JavaScript is not working?

On the web browser menu click on the "Edit" and select "Preferences". In the "Preferences" window select the "Security" tab. In the "Security" tab section "Web content" mark the "Enable JavaScript" checkbox. Click on the "Reload the current page" button of the web browser to refresh the page.

Why is my JavaScript not working on Chrome?

The main reason why Chrome is unable to load JavaScript is because it is disabled by you intentionally or unintentionally. There are more than five settings that need to be enabled all the time in order to allow Chrome to load JavaScript on any website.

How do you enable JavaScript on my browser?

Activate JavaScript in your browser.
Open Chrome on your computer..
Click. Settings..
Click Security and Privacy..
Click Site settings..
Click JavaScript..
Select Sites can use Javascript..

What went wrong troubleshooting JavaScript?

Often, this error message actually means that we've spelled something wrong. If you are not sure of the correct spelling of a piece of syntax, it is often good to look up the feature on MDN. The best way to do this currently is to search for "mdn name-of-feature" with your favorite search engine.