
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the text visible on the button with JavaScript?
To find the text visible on a button in JavaScript, use the innerHTML property.
Example
You can try to run the following code to learn how to display the text visible −
<!DOCTYPE html> <html> <body> <form id = "myForm"> <button id = "btn" type = "button">My Button</button> </form> <script> var str = document.getElementById("btn").innerHTML; document.write("Button text: "+str); </script> </body> </html>
- Related Questions & Answers
- How to add Visible On click Button in HTML Code ?
- How do I display only the visible text with jQuery?
- How to find the value of a button with JavaScript?
- How to identify elements based on text visible on page in Selenium?
- How to go through all text fields with the "Next" Button on the iPhone/iOS Keyboard?
- How to change Tkinter label text on button press?
- How to set the text direction with JavaScript?
- How to return the color of the text with JavaScript?
- How to copy text to the clipboard with JavaScript?
- How to add and remove names on button click with JavaScript?
- How to find the id of the form a button belongs to in JavaScript?
- How to click on a button with Javascript executor in Selenium with python?
- How to set the color of the text-decoration with JavaScript?
- JavaScript Sum function on the click of a button
- How to draw on the canvas with JavaScript?
Advertisements