I want to get id of my element by using name attribute, but there is an simple method in javascript. Here is the HTML
<input type="text" name="name" id="id">
In javacript,
var ele = document.getElementsByName( 'name' ); var id = ele[0].getAttribute( 'id' );
You might also like:
How to get current date and time (yyyy-mm-dd H:i:s) using javascript09-03-2017 javascript date time |
Get next date from given date in javascript06-03-2017 date javascript next date |
Navigate to another page using java script06-03-2017 javascript redirection navigation |
How to set or update or push the values into Object in javacript27-02-2017 javascript set update push object |
How to remove last / value from url in javascript27-02-2017 array javascript last value |