本文介绍了如何在jQuery中选择数据ID和数据操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是此问题的后续措施:使用javascript:function语法和jQuery选择器进行Ajax调用
This is a follow-up to this question: Using javascript:function syntax versus jQuery selector to make Ajax calls
我将如何选择此片段?
<div data-id="54" data-action="follow-global-id" class="add-to-list">here is my answer</div>我在下面有id值,并尝试过
I have the id value below and tried this
$('.add-to-list[data-action|="action-follow-global-id"][data-id|=id]').text('here is the things jtjt in the id value');但没有骰子.需要将这些AND在一起.
but no dice. Need to be AND'ing these together.
寻求帮助
推荐答案未测试,但应该可以工作:
Didn't test it, but should work:
var id = 54; $('.add-to-list[data-action=follow-global-id][data-id='+id+']').text('something');更多推荐
如何在jQuery中选择数据ID和数据操作
发布评论