使用javascript问题在文本框上选择值

使用javascript问题在文本框上选择值,javascript,twitter-bootstrap,popover,Javascript,Twitter Bootstrap,Popover,我尝试使用我的弹出窗口选择列表项显示文本框,它不显示,这个问题怎么办?请帮我解决这个问题,我试着去做,但没有解决这个问题,看代码这是结构,你可以理解它 我的代码部分 Html $(文档).ready(函数(){ $('.popr').popr(); }); $(文档)。在('click','#feugate',函数(){ 警惕(‘步态’); }); $(文档).ready(函数(){ $('[data toggle=“popover”]')。popover(); $('[data toggl

我尝试使用我的弹出窗口选择列表项显示文本框,它不显示,这个问题怎么办?请帮我解决这个问题,我试着去做,但没有解决这个问题,看代码这是结构,你可以理解它

我的代码部分 Html

$(文档).ready(函数(){
$('.popr').popr();
});
$(文档)。在('click','#feugate',函数(){
警惕(‘步态’);
});
$(文档).ready(函数(){
$('[data toggle=“popover”]')。popover();
$('[data toggle=“popover”]')。在(“单击”,函数(){
$(“#messageTextBox”).val($(this.find(“div”).text());
});
});
(函数($){
$.fn.popr=函数(选项){
变量集=$.extend({
“速度”:200,
“模式”:“底部”
},选项);
返回此值。每个(函数(){
var popr_cont='.popr_container'+set.mode;
var popr_show=true;
$(此)。单击(函数(事件)
{
$('.popr_container_top').remove();
$('.popr_container_bottom').remove();
如果(流行音乐节目)
{
event.stopPropagation();
popr_show=假;
}
其他的
{
popr_show=真;
}
var d_m=设置模式;
if($(this.attr('data-mode'))
{
d_m=$(this.attr('data-mode'))
popr_cont='.popr_container_'+d_m;
}
var out=''+$('div[data box id=“'+$(this).attr('data-id')+''']')).html();
$(此)。追加(输出);
var w_t=$(popr_cont).outerWidth();
var w_e=$(this).width();
var m_l=(w_e/2)-(w_t/2);
$(popr_cont).css('margin-left',m_l+'px');
$(this.removeAttr('title alt');
如果(d_m=='top')
{
var w_h=$(popr_cont).outerHeight()+39;
$(popr_cont).css('margin-top','-'+w_h+'px');
}
$(popr_cont).fadeIn(设定速度);
});
$('html')。单击(函数()
{
$('.popr_container_top').remove();
$('.popr_container_bottom').remove();
popr_show=真;
});
});
};
})(jQuery)
.popr
{
光标:指针;
}
波普先生
{
颜色:#333;
文字装饰:无;
边界:0;
}
.popr盒
{
显示:无;
}
.popr_内容
{
背景色:#fff;
填充:7px0;
边距:0;宽度:200px;
高度:自动;
}
.popr项目
{
字体系列:无衬线;
颜色:#333;文本对齐:居中;
字体大小:16px;
填充:4px29px 5px29px;边框底部:实心1px#fbeeee;
}
.popr项目:悬停
{
颜色:#333;
背景色:#DCDC;
}
.popr_容器_底部
{
显示:无;
位置:绝对位置;
边缘顶部:10px;
盒影:2PX2PX5PX#f9f9f9;
z指数:1000;
}
.popr_容器_顶部
{
显示:无;
位置:绝对位置;
盒影:2PX2PX5PX#f9f9f9;
z指数:1000;
}
.popr_point_top
{
位置:相对位置;
背景:#fff;
边框:1px实心#DCDC;
}
.popr_point_top、.popr_point_bottom{
位置:相对位置;
背景:#fff;
边界半径:12px;
}
.popr_point_top:之后,.popr_point_top:之前
{
位置:绝对位置;
指针事件:无;
边框:实心透明;
最高:100%;
内容:“;
身高:0;
宽度:0;
}
.popr_point_top:之后
{
边框顶部颜色:#fff;
边框宽度:8px;
左:50%;
左边距:-8px;
}
.popr_point_top:之前
{
边框顶部颜色:#DCDC;
边框宽度:9px;
左:50%;
左边距:-9px;
}
.popr_点_底:之后,.popr_点_底:之前
{
位置:绝对位置;
指针事件:无;
边框:实心透明;
底部:100%;
内容:“;
身高:0;
宽度:0;
}
.popr_point_bottom:之后
{
边框底色:#fff;
边框宽度:8px;
左:50%;
左边距:-8px;
}
.popr_point_bottom:之前
{
边框底色:#DCDC;
边框宽度:9px;
左:50%;
左边距:-9px;
}
.popover标题{
文本对齐:居中;颜色:红色;
}
.定制府绸{
边界:没有!重要;
文本对齐:居中;
}
.定制popover li:第n个孩子(2){
边框顶部:1px实心#ccc!重要;
}
.定制府绸李:最后一个孩子{
边框顶部:1px实心#ccc!重要;
}
#标题pop{字体大小:12px;颜色:#b89981;}

票据类别

Id不应包含空格
您只需删除
类别

<input class="form-control input-sm" id="messageTextBox" type="text" placeholder="Select category">

同样的注意事项也应适用于
id=“popover sectio selectBox”

注意:您正在将
onchange
事件附加到
div
并尝试访问
div
的属性
,但之后没有做任何更改


希望这有帮助。

您需要知道的是,元素
id
在页面上只能是一个,但您可以有许多
,您可以调用jQuery plugin
.popr()
,但不定义它,请稍后调用它

(函数($){
$.fn.popr=函数(选项){
变量集=$.extend({
“速度”:200,
“模式”:“底部”
},选项);
返回此值。每个(函数(){
var popr_cont='.popr_container'+set.mode;
var popr_show=true;
$(此)。单击(函数(事件){
$('.popr_container_top').remove();
$('.popr_container_bottom').remove();
如果(流行音乐节目){
event.stopPropagation();
popr_show=假;
}
否则{
波普