I have a button next to
<input type='button' value='Generate' onclick='f1()' />
now the function f1 should show a warning window containing the value of the button. in this case "Create"
How to do it?
I tried
alert(this); alert(this.val());
he does not work
Try it.
<input type='button' value='Generate' onclick='f1(this)' />
Now remind
function f1(objButton){ alert(objButton.value); }
PS: val() is actually a jQuery value implementation
val()
value
Or you do it:
<button id='button' value='Generate' onclick='f1()'>Generate</button>
Then this is for javascript:
Const click = document.getElementById('button') Function f1{ Alert(`${click.Value}`) }
Source: https://habr.com/ru/post/1482784/More articles:Azure SQL Server CE Initialization string format does not meet specification starting with index 0 - c #I keep getting "Not Found. Passthru Authentication" to log into Facebook to connect using Devise - Need to debug - ruby-on-railsSorting gives inconsistent results due to loop binding - cHow to use pattern matching for two or more regular expressions in scala - scalaHTML5 Canvas moving an object to mouse position - javascriptProblems Zero-Doubling Serialization Using Protobuf-net - protobuf-netmousewheel event not working in ie - javascriptSocket.io and Express3 - 404 at client request / socket.io / socket.io.js - node.jsAccepting any type of STL container and using its value type - c ++elisp: slash in identifiers - identifierAll Articles