我正在开发一个网页,该网页接受我应该随后提交给数据库的标签
目前我已经能够使用此将值传递到文本字段
<select name="one" onchange="if (this.value=='4'){
document.getElementById('cursor').value = 'one,two';
}
;
">
<option value="" selected="selected">Select...</option>
<option value="1">1</option>
<option value="2">3</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="other">Other</option>
</select>
<input name="tags" type="text" id="cursor">
现在我正在尝试向上方的文本字段添加更多功能
使用tag-it javascript库
在此链接:
http://aehlke.github.io/tag-it/
在我的文本字段中创建标签
<link href="css/jquery.tagit.css" rel="stylesheet" type="text/css">
<link href="css/tagit.ui-zendesk.css" rel="stylesheet" type="text/css">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-
ui.min.js" type="text/javascript" charset="utf-8"></script>
<!-- The real deal -->
<script src="js/tag-it.js" type="text/javascript" charset="utf-8">
</script>
<script>
$(function(){
var sampleTags =
['Wordpress','Joomla','Html','CSS','JavaScript/jQuery','JavaScript
Frameworks','Responsive Design','Testing/Debugging','Building and
Automation Tools/Web Performance','Command Line','Core Python','Web
frameworks','Object-relational mappers','Multi-process
architecture','Developing and using RESTful APIs','Building Python
application','Script writing','Systems administration'];
//-------------------------------
// Minimal
//-------------------------------
$('#myTags').tagit();
//-------------------------------
// Single field
//-------------------------------
$('#singleFieldTags').tagit({
availableTags: sampleTags,
// This will make Tag-it submit a single form value, as a
comma-delimited field.
singleField: true,
singleFieldNode: $('#cursor')
});
这是我遇到问题时,textfield值不再像以前那样更新。
我之所以这样想,是因为它是由标签库访问的ID。
因为当我从tag-it函数中取消我的ID时
例如此处
comma-delimited field.
singleField: true,
singleFieldNode: $('#cursor2')
// changed my id here to cursor2, now the select menu function is workin
again
});
我该如何工作,我需要tag-it函数起作用,并且还需要能够基于选择菜单更新文本字段的值
谢谢