I am just trying to use alert and put a string variable inside the alert and get an error:
Uncaught TypeError: Property 'alert' of object [Object Window] is not a function
My code is:
var shortenurl = msg.d;
alert(shortenurl);
I've checked the value and it has a string inside, not an object.
The reason alert() does not work is because previously you have checked "prevent this page from creating additional dialoug" checkbox. lets take a look at this code. There will be two alert boxes if you run the code.
The TypeError: "x" is not a function can be fixed using the following suggestions: Paying attention to detail in code and minimizing typos. Importing the correct and relevant script libraries used in code. Making sure the called property of an object is actually a function.
The alert() is a method of the window object.
The alert() method is used to show an alert box on the browser window with some message or warning. We can use it as a message or as a warning for the user. Approach: To show an alert on the browser window, we make a button.
Somewhere in your code you overrode alert
. Check for var alert = ...
or some other kind of declaration like that. Also check for window.alert
declarations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With