Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQueryAjax成功更改类和文本_Jquery_Ajax - Fatal编程技术网

jQueryAjax成功更改类和文本

jQueryAjax成功更改类和文本,jquery,ajax,Jquery,Ajax,我有一个链接: <a href="#" class="confirmed" data-ev="1"> <i class="icon-pencil"></i> <span class="text-warning">confirm this!</span> </a> 将类添加为 用 将文本内容设置为 这是非常简单的jQuery任务,您可以很容易地通过使用找到它们。这也是我的帖子不包含任何代码的原因。添加带有 用 将文本

我有一个链接:

<a href="#" class="confirmed" data-ev="1">
  <i class="icon-pencil"></i>
  <span class="text-warning">confirm this!</span>
</a>
将类添加为

将文本内容设置为

这是非常简单的jQuery任务,您可以很容易地通过使用找到它们。这也是我的帖子不包含任何代码的原因。

添加带有

将文本内容设置为


这是非常简单的jQuery任务,您可以很容易地通过使用找到它们。这也是我的帖子不包含任何代码的原因。

您得到了家长


您已经获得了父级


我的锚是多锚的,所以我不能在“点击”上更改,当然我会搜索和谷歌
在里面找到
i
-标记。谢谢,现在一切都好了,Josh在你之前解决了,很抱歉我的假问题。我的锚是多个的,所以我不能在“点击”上更改,当然我搜索和谷歌了。
$(that)。find('i')。addClass('which-dude')
找到
i
-标签。谢谢,现在没事了,Josh在你之前解决了,很抱歉我的假问题。
$(".confirmed").on("click", function(e){
   e.preventDefault();
   var that  = this;
   $.ajax({
    url: '/confirmed/',
    type: 'POST',
    data: {
      event_type: $(that).data('ev')
    },
        success: function(result) {
          $(that).data('ev',"10");
          // here I want to change the class of i tag to "icon-ok"
          // and span.class to "text-success"
          // and span.text to "confirmed"
        }
  });
});
$(that).find('i').addClass('icon-ok');
$(that).find('span').text('blah');