html-input

Html/PHP - Form - Input as array

非 Y 不嫁゛ 提交于 2019-11-26 00:33:41
问题 I got a form like this <form> <input type=\"text\" class=\"form-control\" placeholder=\"Titel\" name=\"levels[level]\"> <input type=\"text\" class=\"form-control\" placeholder=\"Titel\" name=\"levels[build_time]\"> <input type=\"text\" class=\"form-control\" placeholder=\"Titel\" name=\"levels[level]\"> <input type=\"text\" class=\"form-control\" placeholder=\"Titel\" name=\"levels[build_time]\"> </form> What I\'d like to have as $_POST output is an array like Array ( [1] => Array ( [level] =

What&#39;s the proper value for a checked attribute of an HTML checkbox?

独自空忆成欢 提交于 2019-11-26 00:16:36
问题 We all know how to form a checkbox input in HTML: <input name=\"checkbox_name\" id=\"checkbox_id\" type=\"checkbox\"> What I don\'t know -- what\'s the technically correct value for a checked checkbox? I\'ve seen these all work: <input name=\"checkbox_name\" id=\"checkbox_id\" type=\"checkbox\" checked> <input name=\"checkbox_name\" id=\"checkbox_id\" type=\"checkbox\" checked=\"on\"> <input name=\"checkbox_name\" id=\"checkbox_id\" type=\"checkbox\" checked=\"yes\"> <input name=\"checkbox

change type of input field with jQuery

元气小坏坏 提交于 2019-11-25 23:05:23
问题 $(document).ready(function() { // #login-box password field $(\'#password\').attr(\'type\', \'text\'); $(\'#password\').val(\'Password\'); }); This is supposed to change the #password input field (with id=\"password\" ) that is of type password to a normal text field, and then fill in the text “Password”. It doesn’t work, though. Why? Here is the form: <form enctype=\"application/x-www-form-urlencoded\" method=\"post\" action=\"/auth/sign-in\"> <ol> <li> <div class=\"element\"> <input type=\

Disable/enable an input with jQuery?

99封情书 提交于 2019-11-25 22:18:43
问题 $input.disabled = true; or $input.disabled = \"disabled\"; Which is the standard way? And, conversely, how do you enable a disabled input? 回答1: jQuery 1.6+ To change the disabled property you should use the .prop() function. $("input").prop('disabled', true); $("input").prop('disabled', false); jQuery 1.5 and below The .prop() function doesn't exist, but .attr() does similar: Set the disabled attribute. $("input").attr('disabled','disabled'); To enable again, the proper method is to use

<button> vs. <input type=“button” />. Which to use?

我们两清 提交于 2019-11-25 21:53:21
问题 When looking at most sites (including SO), most of them use: <input type=\"button\" /> instead of: <button></button> What are the main differences between the two, if any? Are there valid reasons to use one instead of the other? Are there valid reasons to use combine them? Does using <button> come with compatibility issues, seeing it is not very widely used? 回答1: Here's a page describing the differences (basically you can put html into a <button></button> ) And another page describing why

Best way to remove an event handler in jQuery?

…衆ロ難τιáo~ 提交于 2019-11-25 21:47:57
问题 I have an input type=\"image\" . This acts like the cell notes in Microsoft Excel. If someone enters a number into the text box that this input-image is paired with, I setup an event handler for the input-image . Then when the user clicks the image , they get a little popup to add some notes to the data. My problem is that when a user enters a zero into the text box, I need to disable the input-image \'s event handler. I have tried the following, but to no avail. $(\'#myimage\').click

Change an HTML5 input&#39;s placeholder color with CSS

倖福魔咒の 提交于 2019-11-25 21:38:18
问题 Chrome supports the placeholder attribute on input[type=text] elements (others probably do too). But the following CSS doesn\'t do anything to the placeholder\'s value: input[placeholder], [placeholder], *[placeholder] { color: red !important; } <input type=\"text\" placeholder=\"Value\"> Value will still remain grey instead of red . Is there a way to change the color of the placeholder text? 回答1: Implementation There are three different implementations: pseudo-elements, pseudo-classes, and