轻松搜索元素Jquery [英] Easy search element Jquery

查看:70
本文介绍了轻松搜索元素Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!

有什么问题,我尝试获取价值输入并将其设置为选定的选项



Hello!
What is wrong, i try get value input and set it to selected option

var text = $(this).closest('.item').find('.element_edit').val();
  alert(text); //good
  $(this).closest('.item').find('select:selected').val(text);

推荐答案

this )。nearest(' .item')。find(' 。element_edit')。val();
alert(text); // good
(this).closest('.item').find('.element_edit').val(); alert(text); //good


)。最近(' 。item')。find(' select:selected')。val(text);
(this).closest('.item').find('select:selected').val(text);


所以,做了这样的:


So, made such:


这篇关于轻松搜索元素Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆