Try this.
<input type="button" value="Generate" onclick='f1(this)' />
Now alert like
function f1(objButton){
alert(objButton.value);
}
P.S: val()
is actually a jQuery implementation of value
More Related Contents:
- Switching to the new function writing format
- $(document).ready equivalent without jQuery
- How to get a word under cursor using JavaScript?
- Do you need text/javascript specified in your tags?
- How to get background image URL of an element using JavaScript?
- JS replace not working on string [duplicate]
- What is the difference between setTimeout(fn, 0) and setTimeout(fn, 1)?
- javascript – How to make this code work? [duplicate]
- How to access object property with invalid characters
- Userscript to wait for page to load before executing code techniques?
- Difference of calling a function with and without parentheses in JavaScript
- How can I tell if a browser supports
- res.download() not working in my case
- Access index of the parent ng-repeat from child ng-repeat
- jQuery – Create hidden form element on the fly
- Setting DIV width and height in JavaScript
- Promises, pass additional parameters to then chain
- jQuery: checking if the value of a field is null (empty)
- IE’s toLocaleString has strange characters in results
- GmailApp – Add label to specific message, not the thread
- lodash debounce not working in anonymous function
- Auto Mobile Site Redirect
- Why if([]) is validated while [] == false in javascript?
- Copying of an array of objects to another Array without object reference in javascript(Deep copy)
- AngularJS Load Data from Service
- Proper use of ||
- javascript replace globally with array
- Is there a JavaScript alert that doesn’t pause the script?
- The given origin is not allowed for the given client ID (GSI)
- Geolocation closest location(lat, long) from my position