当我点击删除按钮时,它会删除所有值。是否可以删除每个值?
我提供以下代码:
http://codepen.io/anon/pen/grRKEz?editors=1010
In [6]: r = requests.get("https://flipboard.com/section/%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%B9-3uscfrirj50pdtqb")
In [7]: cont = r.content
In [8]: "post item" in cont
Out[8]: False
答案 0 :(得分:3)
由于表单将包含在div中的信息附加到“gettingValues”div,因此您只需删除父元素。
像这样:
$('.gettingValues').on('click', "input[name='deleteHistory']", function() {
//var div = "getting form values<input data-name='edit' type='button' value='Edit' name='editHistory'><input data-name='delete' type='button' name='deleteHistory' value='Delete'>"; //No need for this line.
console.log("Data deleted");
//$('.gettingValues').html(div); //Don't reset the html.
if($(this).parent().hasClass('gettingValues')) return false; //Don't remove the container.
$(this).parent().remove(); //Remove the containing div only.
//deleteHistoryAPI(data);
});