[英]How can I get the actual value into an hidden field
I'm using the Iconselect and I wanted to ask how I can transmit the actual and/or selected value into an hidden field - I can't find a solution :( 我正在使用Iconselect,我想问如何将实际和/或选定的值传输到隐藏字段中-我找不到解决方案:(
<input type="hidden" id="recommandation" name="recommandation" value="" />
...
<script>
var iconSelect;
window.onload = function(){
iconSelect = new IconSelect("my-icon-select",
{'selectedIconWidth':24,
'selectedIconHeight':24,
'selectedBoxPadding':1,
'iconsWidth':20,
'iconsHeight':20,
'boxIconSpace':1,
'vectoralIconNumber':4,
'horizontalIconNumber':4});
var icons = [];
icons.push({'iconFilePath':'/images/sampledata/eval-1.jpg', 'iconValue':'1'});
icons.push({'iconFilePath':'/images/sampledata/eval-2.jpg', 'iconValue':'2'});
icons.push({'iconFilePath':'/images/sampledata/eval-3.jpg', 'iconValue':'3'});
iconSelect.refresh(icons);
};
</script>
Thanks a lot 非常感谢
$("id-of-selector").on('blur', function(){
$('#recommandation').val = this.val;
});
or 要么
var element = document.getElementById('id-of-selector')
element.addEventListener('blur', function(e){
document.getElementById('recommandation').value = element.value;
});
In taking a quick look at IconSelect, it appears you could do something like: 快速浏览IconSelect时,您似乎可以执行以下操作:
$('#my-icon-select').on('changed', function(){
$('#recommandation').val(iconSelect.getSelectedValue());
});
I don't know about iconselect never used it but manipulating the value with jquery it does not matter if it is hidden look at this: 我不知道iconselect从未使用过它,但是用jquery操纵它的值并不重要,如果它是隐藏的,请看以下内容:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.