打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
jquery textext
Get textext tags in javascript?
0favorite
Hello Everyone i have this problem and really don't know how to solve it: i'm using Textext tool to my website ,i type all my tags in the textarea but when i need the tags i can't get them here is my code:
html code:
<textarea id="tagsa" rows="1" cols="70" style="color: black;" placeholder="Add Your Article Tags.. Max=7" ></textarea>and here is my textext jquery code:
function checkLength() { if ($("#tagsa").next().children().length < 7) { return true; } return false; }$('#tagsa').textext({ plugins: ' prompt autocomplete ajax arrow clear suggestions tags', prompt: 'Add one...', ajax: { url: '../data.json', dataType: 'json', cacheResults: true }, tagsItems: eval(get_suggestion()), //eval(get_suggestion()), ext: { tags: { addTags: function (tags) { if (checkLength()) { $.fn.textext.TextExtTags.prototype.addTags.apply(this, arguments); } else alert("Only 7 Tags Allowed"); } } }}).bind('tagClick', function (e, tag, value, callback) { var url = "Finder.aspx?tag=" + value; window.location = url;}).bind('isTagAllowed', function (e, data) { var formData = $(e.target).textext()[0].tags()._formData, list = eval(formData); // duplicate checking if (formData.length && list.indexOf(data.tag) >= 0) { data.result = false; }});i tried this:
alert(document.getElementById("tagsa").value)but it doesn't show me the inner text/tags
can any one help me with this?
javascript jquery html jquery-textext
shareimprove this question
asked Nov 30 '15 at 20:33
Mohemmad_B87112
I am not sure I understand your question/problem. Is your alert not working even though there is text in your textarea? – Fuzzzzel Nov 30 '15 at 22:48
It's unclear what you are asking. Please add more details and clarify, and we'd be happy to help you out. The more code you isolate, the better -- we're much more likely to help with short, isolated code snippets. – gladsocc Nov 30 '15 at 23:21
2 Answers
activeoldestvotes
1accepted
I couldn't find this operation in the plugin's docs, but after diving in the code I found a way.
$('#textarea').textext({ plugins: 'tags', tagsItems: [ 'PHP', 'Closure', 'Java' ]});$('#btn').click(function(){ var tags = $('#textarea').textext()[0].tags()._formData; $('#result').html(JSON.stringify(tags));});<script src="https://code.jquery.com/jquery-2.1.4.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-textext/1.3.0/jquery.textext.min.js"></script><textarea id="textarea"></textarea><br /><button id="btn">Show Tags</button><hr /><pre id="result"></pre>
http://jsbin.com/joquga
shareimprove this answer
answered Nov 30 '15 at 21:35
Mosh Feu4,35732049
Wow You are a genius Thanks – Mohemmad_B Nov 30 '15 at 21:45
@MohemmadAlBughdadi Thanks for you words ;). My pleasure. Good luck. – Mosh Feu Nov 30 '15 at 21:51
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
jquery跨域提交问题
inkscape支持环境的安装和配置
《研磨struts2》第十四章对Ajax的支持之14.3AjaxJSPtags
jQuery加PHP实现图片上传并提交
Jquery重新学习之五[操作JSON数据]
Jquery解析json数组字符串
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服