如何设置使用Jquery输入字段的名称属性? [英] How can I set the Name attribute of an input field using Jquery?
本文介绍了如何设置使用Jquery输入字段的名称属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
快速的问题......我不知道我怎样才能做到这一点。
好吧,我有一个输入字段像这样的:
<输入类型=文本ID =输入1大小=10NAME =值=级=检查other_amount的onfocus =切换('收音机1','输入1'); />
我想点击一个div #resetPrompt的ID,并从other_amount
输入打发无聊的name属性我的想法它是一个漫长的一天。
谢谢你们,
太
解决方案
$('#resetPrompt')。点击(函数(){
$('#输入1')ATTR('名','other_amount')。
});
Quick question... I was wondering how I can get this to happen.
Okay I have an input field like such:
<input type="text" id="input1" size="10" name="" value="" class="checked other_amount" onfocus="Toggle('radio1', 'input1');" />
I would like to click on a div with an ID of #resetPrompt and fill the empty name attr from the input with "other_amount"
I'm out of ideas its been a long day
Thanks guys,
Matt
解决方案
$('#resetPrompt').click(function(){
$('#input1').attr('name', 'other_amount');
});
这篇关于如何设置使用Jquery输入字段的名称属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文