很多时候jquery只能或者应该回去一个集合。然后通过this获取触发时间的对象及相关属性

  this.jq('#needsType').on("click", ".selection", function (e) {

       e.stopPropagation();
    //获取父级元素,使得隐藏的ul在添加on方法后显示出来
var that = $(this).parent(); console.log(that); that.addClass('on'); that.find('ul li').click(function () {
    //获取当前点击元素的data属性的val值
var val= $(this).data('val'); that.find('input[type=text]').val($(this).text()); that.removeClass('on'); }); });

 网页部分

<div >已回答</li>
</ul>
</div>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2021-05-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2021-11-30
  • 2021-05-31
相关资源
相似解决方案