Reputation: 507
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.
Upvotes: 1
Views: 1845
Reputation: 507
Finally... I was able to find the code to get the value. It's as simple as this:
<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>
Specifically, all I needed to do was this:
agoras = $('#tags').textext()[0].hiddenInput().val();
Upvotes: 3