Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<button> Click me</button>

I try to executed on console developer tool

What I have tried:

when I opened developer tool in google chrome and put
<button> Click me</button>

control on console then I got error -

Uncaught SyntaxError: Unexpected token '<'

I tried to fix issues but unable to fixed this issues please help me

Thanks
Posted
Updated 7-Jul-22 2:11am
v3

1 solution

You can't put HTML directly into the console in the developer tools window. The console is designed for interacting with Javascript instead. For example, you could type console.log('Hello world'); in there and you'll see it print out the message. The only way you could possibly print some HTML is to write document.write('<button>Hello</button>');, but that's inefficient. Instead, create a .html file and put your HTML in there.
 
Share this answer
 
Comments
Member 12183079 8-Jul-22 3:49am    
Hi
I am getting error in this link given below-

document.write('<button style="width:100;height:20" onClick="window.location='/scripts/broker.exe?_program=websas.COMPLAINTS_input6.sas&_debug=0&CCNUM=C0000582 '">Upload Image</button> ')




could you please help where is problem in this link
Uncaught SyntaxError: Invalid left-hand side in assignment
Chris Copeland 8-Jul-22 5:34am    
You're getting that error because you've got apostrophes (') inside your string. You need to escape any apostrophes inside your string with a backslash (\), for example: 'This is text \'and\' this was escaped'

This is also basic Javascript knowledge, I recommend you look at some JS tutorials online. Also, why are you printing a button to the page that links to an executable file when the text of the button is Upload Image? That seems dodgy.
Member 12183079 8-Jul-22 6:25am    
I tried but failed please type code
Chris Copeland 8-Jul-22 6:31am    
I won't provide you with the code, if you're interested in getting into web-development then I recommend you start by looking at some tutorial websites. Everyone has to start somewhere and asking for code to be given to you is no way to learn. Take a look at the below websites for a good starting point:

HTML Tutorial - W3Schools[^]
JavaScript Tutorial - W3Schools[^]
Member 12183079 8-Jul-22 7:03am    
I request to you please give me code .in my team everybody stuck in this code i will learn but please give me because everybody has been fed up please.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900