html-input

How to handle floats and decimal separators with html5 input type number

旧城冷巷雨未停 提交于 2019-11-26 07:57:44
问题 Im building web app which is mainly for mobile browsers. Im using input fields with number type, so (most) mobile browsers invokes only number keyboard for better user experience. This web app is mainly used in regions where decimal separator is comma, not dot, so I need to handle both decimal separators. How to cover this whole mess with dot and comma? My findings: Desktop Chrome Input type=number User enters \"4,55\" to input field $(\"#my_input\").val(); returns \"455\" I can not get the

Input type DateTime - Value format?

前提是你 提交于 2019-11-26 07:39:26
问题 In which format should I put the date and time, for use in the HTML5 input element with datetime type? I have tried: 1338575502 01/06/2012 19:31 01/06/2012 19:21:00 2012-06-01 2012-06-01 19:31 2012-06-01 19:31:00 None of them seem to work. 回答1: For <input type="datetime" value="" ... A string representing a global date and time. Value : A valid date-time as defined in [RFC 3339], with these additional qualifications: •the literal letters T and Z in the date/time syntax must always be

how to POST/Submit an Input Checkbox that is disabled?

馋奶兔 提交于 2019-11-26 04:45:03
问题 I have a checkbox that, given certain conditions, needs to be disabled. Turns out HTTP doesn\'t post disabled inputs. How can I get around that? submitting the input even if it\'s disabled and keeping the input disabled? 回答1: UPDATE : READONLY doesn't work on checkboxes You could use disabled="disabled" but at this point checkbox's value will not appear into POST values. One of the strategy is to add an hidden field holding checkbox's value within the same form and read value back from that

Get data from file input in JQuery

本秂侑毒 提交于 2019-11-26 04:36:48
问题 I actually have a file input and I would like to retrieve the Base64 data of the file. I tried: $(\'input#myInput\')[0].files[0] to retrieve the data. But it only provides the name, the length, the content type but not the data itself. I actually need these data to send them to Amazon S3 I already test the API and when I send the data through html form with encode type \"multipart/form-data\" it works. I use this plugin : http://jasny.github.com/bootstrap/javascript.html#fileupload And this

Why is HTML5 input type datetime removed from browsers already supporting it?

自作多情 提交于 2019-11-26 03:54:28
问题 I was wondering why all browsers, like Chrome versions higher than 26, which had support in the past for the input datetime removed it? This sounds like a duplicate of this article, but that one is quite aged. It looks like the HTML WG prefers datetime-local (w3c) above datetime (w3c), but why? See this for feature development timeline. What others say: According to mobilexweb.com it was deprecated in iOS \'because it looks too much like the datetime input type\'. Following Google Chrome, now

Using Pipes within ngModel on INPUT Elements in Angular

家住魔仙堡 提交于 2019-11-26 03:18:36
问题 I\'ve an HTML INPUT field. <input [(ngModel)]=\"item.value\" name=\"inputField\" type=\"text\" /> and I want to format its value and use an existing pipe: .... [(ngModel)]=\"item.value | useMyPipeToFormatThatValue\" .... and get the error message: Cannot have a pipe in an action expression How can I use pipes in this context? 回答1: You can't use Template expression operators(pipe, save navigator) within template statement: (ngModelChange)="Template statements" (ngModelChange)="item.value |

Programmatically selecting partial text in an input field

我只是一个虾纸丫 提交于 2019-11-26 02:37:52
问题 How can I programmatically select a specific range of text in an HTML input field? (I don\'t want to select the entire field, just a subset) Also, how can I determine the currently selected range in a field? 回答1: Here's how to select a portion of a text box (range select) and get the selected text: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> Test </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

HTML input - name vs. id [duplicate]

非 Y 不嫁゛ 提交于 2019-11-26 01:23:23
问题 This question already has an answer here: Difference between id and name attributes in HTML 17 answers When using the HTML <input> tag, what is the difference between the use of the name and id attributes especially that I found that they are sometimes named the same? 回答1: In HTML4.01: Name Attribute Valid only on <a> , <form> , <iframe> , <img> , <map> , <input> , <select> , <textarea> Name does not have to be unique, and can be used to group elements together such as radio buttons &

How do I cancel form submission in submit button onclick event?

大兔子大兔子 提交于 2019-11-26 00:59:38
问题 I\'m working on an ASP.net web application. I have a form with a submit button. The code for the submit button looks like <input type=\'submit\' value=\'submit request\' onclick=\'btnClick();\'> . I want to write something like the following: function btnClick() { if (!validData()) cancelFormSubmission(); } How do I do this? 回答1: You are better off doing... <form onsubmit="return isValidForm()" /> If isValidForm() returns false , then your form doesn't submit. You should also probably move

Phone: numeric keyboard for text input

让人想犯罪 __ 提交于 2019-11-26 00:52:02
问题 Is there a way to force the number keyboard to come up on the phone for an <input type=\"text\"> ? I just realized that <input type=\"number\"> in HTML5 is for “floating-point numbers”, so it isn’t suitable for credit card numbers, ZIP codes, etc. I want to emulate the numeric-keyboard functionality of <input type=\"number\"> , for inputs that take numeric values other than floating-point numbers. Is there, perhaps, another appropriate input type that does that? 回答1: You can do <input type=