Snippets tagged “input”
33 snippets use this tag.
- Asking the user for input until they give a valid responsePython
To ask the user for input and repeat the prompt until they give a valid response, you can use a while loop and use a try-except block to catch any errors that may occur when trying to convert the user input to the desired data type.
- How do I read from stdin?Python
You can read from stdin in Python using the input function.
- How do I use raw_input in Python 3?Python
In Python 3, the input() function can be used in place of raw_input() to read input from the user.
- How do I wait for a pressed key?Python
Here is an example of how you might wait for a key press in Python:
- How to Add an Onclick Effect with HTML and CSSHTML
In this snippet, we’ll demonstrate how to add an onclick event in CSS. The best way of creating an onclick effect is using the well-known checkbox hack.
- How to Align Labels Next to InputsHTML
In this snippet, you’ll learn how to align <label> elements next to <input> elements. Align labels to the right and left of inputs by using CSS properties.
- How to Align the Placeholder Text of an Input Field in HTMLCSS
The ::placeholder pseudo-element allows styling the placeholder text of a form element. Here you will find out how to align an input field’s placeholder text.
- How to Allow Only Positive Numbers in the Input Number TypeHTML
In this snippet, we’ll demonstrate how to allow only positive numbers in the input number type. You can use the “min” attribute to specify restrictions.
- How to Apply CSS Style to the Element NameCSS
In this snippet, we’re going to demonstrate how you can apply CSS styles to the name of the element. For that, you can use attribute selectors. See examples.
- How to Assign a Checked Initial Value to the Radio ButtonHTML
In this tutorial, find out how you can assign a checked initial value to the radio button with HTML. To achieve that goal, you need to use the checked attribute.
- How to Change Default Text Selection Color Using CSSCSS
Use the CSS ::selection selector to change the default highlight color while selecting texts. Use only CSS and do cool tricks to have a better user experience. All with examples.
- How To Change the Color of an HTML5 Input Placeholder Using CSSCSS
Learn How To Change the Color of an HTML5 Input Placeholder with CSS with W3docs tutorial. Try the code examples yourself. Fast solution.
- How to Change the Input and Button Images with CSSCSS
It may be difficult to style buttons, especially when we need to change them to images. You can change buttons to images with <input> and <button> elements.
- How to Check a Radio Button with jQueryJavaScript
Read the tutorial and learn the right way of checking a radio button with jQuery. Also, read how to handle with different versions of jQuery while checking.
- How to Create a Glowing Border Around an Input FieldCSS
In this snippet, we’re going to demonstrate some examples of creating a glowing border around an input field. For that, you need to use some CSS properties.
- How to Create Contact Form With CSSCSS
Create a contact form for collecting user’s contact details and opinions about your website. Follow the steps and create a contact form with CSS in a simple way.
- How to Create Mailto FormsHTML
Learn about how to create a Mailto forms with examples. See also the advantages that Mailto forms can have.
- How to Create Search BoxesCSS
Create and style beautiful search boxes without any JavaScript code. Learn the steps to create search boxes and find lots of examples in this tutorial.
- How to Disable Zoom on a Mobile Web Page With HTML and CSSCSS
One of the most common inconveniences both developers and users face is the zoom on mobile web pages. Well, we’re here to help you fix that problem.
- How to Get the Value of Text Input Field Using JavaScriptJavaScript
Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.
- How to Make the Content of Input Start from the RightCSS
Sometimes, you may need to make the content (such as a text or number) of input start from the right. Read and find out what properties to use for that.
- How to Match an Empty Input Box with CSSCSS
It is possible to match an empty input box only if the input field is required. In this snippet, we’ll show how to do this using the CSS :valid pseudo-class.
- How to Remove and Style the Border Around Text Input Boxes in Google ChromeCSS
Use outline: none to remove the ugly border color for a form field in Chrome. Learn also how to give your own style for showing that the box is active. All with examples.
- How to Select All Text in HTML Text Input When Clicked Using JavaScriptJavaScript
Read the tutorial and learn the two methods of selecting the entire text in HTML text input when clicked using JavaScript code snippets. Also, see examples.
- How to Set Default HTML Form Focus Without JavascriptHTML
In this tutorial, you’ll see how to set the default HTML form focus. This can be done without Javascript. For that, use the HTML “autofocus” attribute.
- How to Style Input and Submit ButtonsCSS
In this snippet, you will find out how to style input and submit buttons easily. Use various CSS properties to achieve this goal. Read the snippet and try examples.
- How to Use the HTML <fieldset> TagHTML
In this tutorial, you will find some examples of using the HTML <fieldset> element. Besides, you can find out why in general we need the <fieldset> element.
- HTML/PHP - Form - Input as arrayPHP
To create an HTML form that submits an array as a form parameter, you can use the name attribute of the input element and give it a value in the form of an array.
- Java: How to get input from System.console()Java
To get input from the System.console() in Java, you can use the readLine() method of the Console class.
- Take a char input from the ScannerJava
To take a character input from the Scanner in Java, you can use the next() method to read a string and then use the charAt(int index) method to get the first character of that string. Here's an example:
- Using scanner.nextLine()Java
Scanner.nextLine() is a method of the Scanner class in Java that reads a line of text from the input.
- What is aria-label and How to Use ItHTML
In this snippet, you can learn what is aria label, as well as when and how it can be used. Read our tutorial and find examples of using the aria-label attribute.
- Which is the Float Input Type in HTML5HTML
In this tutorial, you’ll learn which is the float input type in HTML5. Read our snippet and try some examples with the step value to see the solution to this problem.