In plain-old JavaScript you can do this:
var inputs = document.getElementsByTagName('input'); for(var i = 0; i < inputs.length; i++) { if(inputs[i].type.toLowerCase() == 'text') { alert(inputs[i].value); } }
In jQuery, you would just do:
// select all inputs of type 'text' on the page $("input:text") // hide all text inputs which are descendants of div class="foo" $("div.foo input:text").hide();
Related Posts:
- Deleting array elements in JavaScript – delete vs splice
- How can I check if an element exists in the visible DOM?
- Counting the occurrences / frequency of array elements
- document.getElementById not working / Display
- How can I generate a rainbow circle using HTML5 canvas?
- Which equals operator (== vs ===) should be used in JavaScript comparisons?
- are there dictionaries in javascript like python?
- How do I get the current date in JavaScript?
- How to do a redirect to another route with react-router?
- Jest spy on functionality
- Use a JSON array with objects with javascript
- Toggle show/hide on click with jQuery
- Client on Node.js: Uncaught ReferenceError: require is not defined
- jQuery .on(‘change’, function() {} not triggering for dynamically created inputs
- How to create a jQuery function (a new jQuery method or plugin)?
- JavaScript TypeError: Cannot read property ‘style’ of null
- How to obtain username from Promise
? - How do you check if a variable is an array in JavaScript?
- Understanding React-Redux and mapStateToProps()
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- How to get the browser to navigate to URL in JavaScript
- Uncaught TypeError: $.post is not a function
- Unable to verify leaf signature
- When and why to ‘return false’ in JavaScript?
- In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide
- Send POST data using XMLHttpRequest
- querySelector vs. getElementById
- Google weather widget on my website
- How to generate a simple popup using jQuery
- How to convert an Object {} to an Array [] of key-value pairs in JavaScript
- Javascript versioning to avoid caching, difference in these practices?
- SyntaxError: Unexpected token o in JSON at position 1
- window.variableName
- What does ${} (dollar sign and curly braces) mean in a string in Javascript?
- How to implement authenticated routes in React Router 4?
- How to create a JQuery Clock / Timer
- Access Control Request Headers, is added to header in AJAX request with jQuery
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- How to check if function exists in JavaScript?
- ActiveXObject is not defined and can’t find variable: ActiveXObject
- How can I get the last character in a string?
- getBoundingClientRect is not a function
- Jquery button click() function is not working
- Make iframe automatically adjust height according to the contents without using scrollbar?
- Uncaught ReferenceError: function is not defined with onclick
- Remove last item from array
- Example JavaScript code to parse CSV data
- addEventListener not working in javascript
- How to access the request body when POSTing using Node.js and Express?
- How do I check whether a checkbox is checked in jQuery?
- Failed to find a valid digest in the ‘integrity’ attribute for resource on a deployed emberjs application
- Cannot read property ‘getHostNode’ of null
- TypeError: Class extends value undefined is not a function or null
- Eslint: How to disable “unexpected console statement” in Node.js?
- How to get native javascript functions source code?
- JavaScript pattern for multiple constructors
- How to manage a redirect request after a jQuery Ajax call
- Get the Highlighted/Selected text
- Video auto play is not working in Safari and Chrome desktop browser
- Replace all spaces in a string with ‘+’
- Is there a standard function to check for null, undefined, or blank variables in JavaScript?
- How to force JavaScript to deep copy a string?
- How to go to a URL using jQuery?
- Uncaught ReferenceError: ga is not defined
- Getting or changing CSS class property with Javascript using DOM style
- How to close a window using jQuery
- Javascript- Multiplying 2 numbers and return number
- What does the $() function do in JavaScript?
- How to change href of tag on button click through javascript
- WP Rest API – How to get featured image
- How to only enqueue block javascript on the frontend when its needed [duplicate]
- Correct place to register and enqueue scripts
- Eliminate render blocking javascript
- The value of attribute [ data-type ] must be in double quotes – custom html widget error
- How to replace a javascript select box onchange event to a form submit action?
- Add tinymce dynamically via Javascript
- How to Add Javascript Only When a Function Exists?
- Make TinyMCE checkbox that returns a value instead of true/false
- TypeError: window.tinyMCE.execInstanceCommand is not a function
- How to load javascript file on homepage in WordPress in order?
- Adding JavaScript to a WordPress website
- wp-env mysqlcheck error:1130
- event/callback on block update?
- How to disable inline css styles generated by Gutenberg editor?
- Vue and wordpress.Bad Request ajax request
- How to add if lt IE9 conditional scripts to functions.php
- wordpress 4.4 upgrade visual editor bullets select for not selected elements
- Script to Automatically Advance to the Next Page of a Paginated Post
- Gutenberg consume wp-json data and reflect in frontend the content
- How to add “on change” to a text input in contact form7?
- How can I get user data into a javascript object?
- Update media library attachments
- WordPress load-scripts.php not loading
- How to use WP switchEditors.switchto(this) JS function in your own script?
- Removing admin javascript
- Can I get the user name in JavaScript?
- Landing function through URL
- Escaping quotes while enqueuing scripts
- Custom JS doesn’t work after 4.9.9 update [closed]
- How do I cycle a JS function in WordPress? [closed]