javascript - Get values from custom tag of a textbox(autocomplete) and push into an array
问题描述
I have a one text-box(autocomplete) on page with id main_text,whose value changes dynamically.
'<'my_custom_tag'>'name1|name2|address|country|provison'<'/my_custom_tag'>'
In above tag please do not consider any single quote, for display purpose i have mentioned it over here,other wise it was only displaying name1|name2|address|country|provison.
I want to get all the value between tags and push it into an array. I have tried using .result method of jquery but it was showing an error stating $(...).result not found
$("#main_text").result(function(event,data,formatted){}
Any alternative approach to achieve the same, we need to .split the value from | so i can get individual values ,after that i will set those values into another text-box.
$("my_name1").val(my_array[0]);
$("my_name2").val(my_array[1]);
$("my_address").val(my_array[2]);
$("my_country").val(my_array[3]);
$("my_provison").val(my_array[4]);
Also, if you check this link jqueryui.com/autocomplete it states .autocomplete is not a function in DOM
解决方案
values = $("my_custom_tag").text().split("|");
推荐阅读
- workflow - 如何将 Watson Knowledge Catalog (WKC) 连接到我的 Oracle Cloud ATP 数据库?
- python - 删除了 jupyter 笔记本单元格 - 有没有办法从仍在内存中的对象返回代码?
- angular - 使用 Angular 自定义电子邮件验证
- shell - 在活动窗口中的选定字段中填充文本 - VBScript、WScript.Shell
- python - 使用 Pandas 根据另一列的值选择一列
- syncfusion - SyncFusion Xamarin:根据内容自动生成 PDF 页面
- python-3.x - 连接 Pandas 数据帧,获取第一个数据帧的 Nan 值
- ios - 在 Apple Watch App 中通过 OAuth 2.0 实现 Slack 授权
- python - 匹配文本后打印行
- node.js - 从 res.send csv 文件中捕获 AngularJS 函数中的响应