单选按钮和一个输入字段(Radio Button and an Input field)
我想设置一个表单,用户可以从一组单选按钮中进行选择,如果他们不喜欢任何选择,他们可以使用最后一个单选按钮,它将在文本框中输入自定义文本。
我在几个网站上看到了这一点。 只是想知道它在哪里以及如何实施
I wanna set up a form where users can choose from a set of radio buttons and if they dont like any choice they can use the last radio button which will have a text field to it where they can enter the custom text.
i have seen this on a few sites. just wondering where and how it was implemented
2021-09-26 15:09
满意答案
我举了个例子,这是你想要的吗? http://www.jsfiddle.net/T7gE7/
var temp = ''; function disableTxt() { var field = document.getElementById("other"); if(field.value != '') { temp = field.value; } field.style.display = "none"; field.value = ''; } function enableTxt() { document.getElementById("other").style.display = "inline"; document.getElementById("other").value = temp; }
I made you an example, is this what you wanted? http://www.jsfiddle.net/T7gE7/
var temp = ''; function disableTxt() { var field = document.getElementById("other"); if(field.value != '') { temp = field.value; } field.style.display = "none"; field.value = ''; } function enableTxt() { document.getElementById("other").style.display = "inline"; document.getElementById("other").value = temp; }
相关问答
更多使用webform上的单选按钮打开另一个可输入数据的字段(Use Radio button on webform to open another field where data can be entered)
你可以用javascript或jquery来做到这一点。 下面是jquery的一个例子。 $(document).ready(function() {
$('input[name="cmtad"][value="Yes"]').click(function() {
$(this).parent().parent().next().show();
}
$('input[name="cmtad"][value="No"]').click(function() {
...
HTML Javascript输入字段是在单选按钮检查/单击时创建的(HTML Javascript input field is created on radio button check/click)
好的,这是一个更优雅的方式,解决了除了5之外的所有方式。 记住,没有“div.id”和“rb.name.id”之类的东西。 <script type="text/javascript">
checked1=false;
checked2=false;
function dynInput(rb) {
if (document.getElementById('raadio').checked && !checked1 || document.getElementById('raadi...
从单选按钮获取输入值(Get input value from a radio button)
PS:当我禁用bootstrap.min.js并添加<div id =“whatever”> </ div>时,代码有效 对于第二个问题,您需要使用value更改innerHTML。 对于第一个问题,您需要更改事件类型。 实际上,你的主要问题是这一行: $('input:radio').click(function() {
对于单选按钮,您需要使用更改事件: $(':radio').on('change', function() {
$(':radio').on('change', funct...
互斥单选按钮和相应的输入字段(Mutually exclusive radio button and corresponding input field)
你可以尝试下面的代码: <div ng-controller="myCntrl">
<table>
<tr>
<td> Sys/Prod/Proc :</td>
<td width="10px"></td>
<td>
<input type="ra...
为什么在键入文本输入时无法选择单选按钮(Why can't a radio button stay selected when typing in text input)
为您创建了一个解决问题的拉取请求。 https://github.com/jansensan/test-angularjs-text-input-in-radio-group/pull/1 正如jw56578已经说过,通过在输入中添加一个值来覆盖vm.appModel.amount属性,这意味着不再检查单选按钮。 我重构了您的代码,因此它包含一个包含属性数量和类型的付款对象。 对于手动付款,现在将设置payment.type(这将控制单选按钮),金额将存储在payment.amount中。 Cre...
通过jquery输入单选按钮后添加标签字段(Add label field after input radio button through jquery)
这是一种使用contents()的方法,因此您可以检查跟随输入的文本节点并仅替换那些文本节点 var $nodes = $('fieldset').contents();
$nodes.each(function (i) {
if ($(this).is('input')) {
var nextNode = $nodes[i + 1];
if (nextNode && nextNode.nodeType == 3) {
var la...
单选按钮和一个输入字段(Radio Button and an Input field)
我举了个例子,这是你想要的吗? http://www.jsfiddle.net/T7gE7/ var temp = '';
function disableTxt() {
var field = document.getElementById("other");
if(field.value != '') {
temp = field.value;
}
field.style.display = "none";
field.value = '...
如果点击单选按钮,则在弹出框中输入字段(Input field in a popup if radio button is clicked)
我认为你想要做的是这样的: $("#active").on("click", function(){
if($(this).is(":checked")){
var popUp=prompt("Please enter Something","Something");
if (popUp!=null){
alert("You wrote "+popUp);
}
}
})
这里是功能性的例子。 https://jsfiddle.net/feragon4...
如何根据单选按钮切换启用/禁用输入字段(How to toggle enable/disable input field based on radio button)
你可以这样做 $(document).ready(function(){
$("#text-inputt").prop('disabled', true);
$('input[type=radio]').click(function(){
if($(this).prop('id') == "lastt"){
$("#text-inputt").prop("disabled", false);
}else{
$("#te...
如何将单选按钮值与输入字段关联(How to associate Radio Button value with Input Field)
如果你得到选项的值是input1 answer是input1或者如果options值是input2,则answer是input2 <input type="radio" name="options" value="input1">Is Correct<br>
<input type="radio" name="options" value="input2">Is Correct
input1是文本框1的名称 input2是文本框2的名称 在表格上获取价值: - $nam=$_POST['opti...
相关文章
更多Solr4.7---Field、CopyField、DynamicField
Field: Field就是一个字段,定义一个Field很简单: 基本上属性也和FieldType类似
...
input 框的自动提示框 错位
所有输入框都是在iframe下面的。浏览器自带的 input自动提示框 在input框下方 40px左
...
Solr Document [null] missing required field: id 的原因
在solr建立索引的时候,如果你提交的doc中没有 id 这个Field,结果Solr在建立索引时候出
...
用‘button’跟‘text’组合代替‘file’,选择文件后点‘submit’,‘file’的值被清空
各位大虾晚上好,我有个问题想请教你们,我想美化html的file外观,但貌似现在还不能用css直接设计
...
solr error logs org.apache.solr.common.SolrException: ERROR: [doc=17] unknown field alias
在solr中 添加新的索引词语时,报如标题所示错误,指定是插入的字段没有在solr索引字段里 可以修改
...
solr required field: id
为了和以前的程序兼容,在solr建立索引的时候,将id设为gid,结果在建立索引时候出现如下错误: o
...
struts2.xml中crud!input什么意思
在看struts2自带的crud的例子中,struts.xml中的crud!input、crud!de
...
微信公众号接口添加菜单时错误(errcode":40017 invalid button type)
POST提交时总是报错: {"errcode":40017,"errms
...
jquery1.4.4的radio选中项
var updkbval=$("input[name=sex][@checked]"
...
启动Solr时报 _version_ field must exist in schema 错误的解决方法
Solr启动时报 org.apache.solr.common.SolrException:org.a
...
最新问答
更多Python / IPython奇怪的不可重现列表索引超出范围错误(Python/IPython strange non reproducible list index out of range error)
你得到IndexError的原因是你的输入文件显然不是完全用制表符分隔的。 这就是为什么当您尝试访问它时, splits[1]没有任何内容。 您的代码可以使用一些重构。 首先,你正在重复使用if -checks,这是不必要的。 这只是将cds0到7个字符,这可能不是你想要的。 我将以下内容放在一起,以演示如何重构您的代码,使其变得更加pythonic和干燥。 我无法保证它能够与您的数据集一起使用,但我希望它可以帮助您了解如何以不同的方式执行操作。 to_sort = [] # W
故事板从表格单元中延伸出来并显示其详细信息披露按钮(storyboard segue from a tablecell an its Detail Disclosure Button)
我不认为你可以链接一个特定的细节披露按钮瓦特/赛格。 我的故事板是非常程序化的B / C我使用了很多定制CGRect等。 所以我倾向于使用这样的东西: -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"ViewControllerIdentifer"
我们可以将Gherkin功能文件与testcomplete集成(Can we integrate Gherkin feature files with testcomplete)
TestComplete不支持Gherkin功能文件。 但是,TestComplete具有SDK,因此可以自己为此创建扩展。 TestComplete does not support Gherkin feature files. However, TestComplete has SDK so it is possible to create an extension for this by yourself.
TrustAllCertificatesCallback被忽略(TrustAllCertificatesCallback is ignored)
我没有做过这样的事情,但看看我认为可以看出错误的例子。 试试这个代码: static class Program { static void Main() { var tcpclient = new TcpClient("remote.example.com", 443); var tcpstream = tcpclient.GetStream(); var sslstream = new SslStream(tcpstream,
返回嵌套元素的索引(Return index of nested element)
您需要获取父li元素的索引。 否则,您将获得列表项内锚点的索引,该索引始终为零。 $(this.parentNode).index(); You need to get the index of the parent li element. Otherwise you are getting the index of the anchor inside the list item, which will always be zero. $(this.parentNode).index();
在数组中重新编号元素的有效方法(Efficient way of re-numbering elements in an array)
您需要多次迭代列表,我认为没有办法解决这个问题。 毕竟,在开始更改元素(第二遍)之前,首先必须确定不同元素的数量(第一遍)。 但是请注意,由于对index的重复调用而not in列表中具有O(n),因此可能具有最多O(n ^ 2)的不同元素的数量。 或者,您可以使用dict而不是value_map的list 。 字典比列表具有更快的查找速度,因此,复杂性应该确实在O(n)的数量级上。 您可以使用(1)字典理解来确定旧值到新值的映射,以及(2)用于创建更新子项的列表理解。 value_map =
Express app定义的`static`文件夹无法正常工作(Express app defined `static` folder not working properly)
选项1 你可以改变这一行: app.use( express.static(__dirname + '/puplic')); //my public folder. 至 app.use('/oneTime', express.static(__dirname + '/puplic')); //my public folder 选项2 我假设你在公共文件夹中有一个js文件夹,然后你需要更改你的HTML代码:
Javascript错误:未捕获TypeError:无法读取null的属性'value'[duplicate](Javascript error: Uncaught TypeError: Cannot read property 'value' of null [duplicate])
这应该工作: Change the above input value and click enter. VALUE HERE
使用node.js和socket.io每秒广播一次(Using node.js and socket.io to broadcast every second)
对于计时器值,请在服务器端本身每秒更新本地计时器。 每当有任何用户进来时,给他这个值以及计时器的总值。 然后客户端将根据dandavis评论在本地启动自己的计时器,但在服务器端保留一些间隔,如15或10秒,服务器将广播当前计时器值,以便客户端相应地进行同步。 简而言之,服务器将每隔10(n:你决定)秒后广播,但它将在本地每秒更新定时器变量。 每当客户端进入时,它将获得总计时器值和当前计时器值。 广播当前出价的休息功能可以以正常方式完成。 For timer value, keep updatin
如何让XMLSerializer将命名空间添加到嵌套对象中的属性?(How do I get the XMLSerializer to add namespaces to attributes in nested objects?)
IXmlSerializable也许? 注意我还添加了(对A ): [XmlElement("A", Namespace = "http://www.example.com/namespace")] public TestSoapHeaderTypeValuePair A {...} 代码如下: public class TestSoapHeaderTypeValuePair : IXmlSerializable { private string _type; private
Copyright ©2023 656463.com All Rights Reserved.滇ICP备2022006988号-50
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们,本站将尽快处理。谢谢合作!