1

I'm using a plugin from: http://textextjs.com/

This is the summary of my code:

<body>
<script type = "text/javascript">
agoras = $('#tags').val();
alert(agoras);
</script>

<input type="text" id="tags" />

<script type="text/javascript">
$('#tags').textext({
plugins : 'autocomplete filter tags',
tagsItems : [ 'Basic', 'Javascript', 'PHP', 'Scala' ]
});
</script>

</body>

The tags work great. My only problem is that I can't seem to get the input. It always just alerts a blank string. I tried looking at the docs but I just can't find the command that will get the input from the text box. Any ideas?

P.S. I already tried changing the arrangement of the script tags. No other arrangement still makes it work. I really think there's a js function to get the input content.

4

1 回答 1

3

最后......我能够找到代码来获取价值。就这么简单:

<body>
<script type = "text/javascript">
agoras = $('#tags').textext()[0].hiddenInput().val();
alert(agoras);
</script>

<input type="text" id="tags" />

<script type="text/javascript">
$('#tags').textext({
plugins : 'autocomplete filter tags',
tagsItems : [ 'Basic', 'Javascript', 'PHP', 'Scala' ]
});
</script>

</body>

具体来说,我需要做的就是:

agoras = $('#tags').textext()[0].hiddenInput().val();
于 2013-06-02T07:46:30.350 回答