I am having a list of users with delete
hyperlink assume
<a href="#" onclick="delete(id)">Delete</a>
And i have a bo box at the top to filter specific user using user id.
The delete action will performed with ajax and it reloads the content. The content gets reloaded but the bo box contains the deleted id. Is there any way to clear it using jquery.
I am having a list of users with delete
hyperlink assume
<a href="#" onclick="delete(id)">Delete</a>
And i have a bo box at the top to filter specific user using user id.
The delete action will performed with ajax and it reloads the content. The content gets reloaded but the bo box contains the deleted id. Is there any way to clear it using jquery.
Share Improve this question asked Aug 24, 2013 at 10:58 PrabhakaranPrabhakaran 4,01915 gold badges51 silver badges119 bronze badges 2- Please show us the code you have tried. – mishik Commented Aug 24, 2013 at 11:00
- Please include your code, or just add it in jsfiddle and give us the link – Imane Fateh Commented Aug 24, 2013 at 11:01
5 Answers
Reset to default 1You can remove an option like
$("#selectBox option[value='option1']").remove();
Yes,If you know the value which you want to delete,
Try
$("#selectionid option[value='deletedUser']").remove();
Note:Do it in Ajax success function
You could try something like this:
$(function delete(id) {
$('#my-select option[value="'+ id +'"]').remove();
});
Try this...
$( "#myselect option:selected" ).remove(); // because your deleted user id will be selected
Here first you get the element in jQuery selector through id or class the find the option which you want to delete or remove.. like if first element then eq(0), if second then eq(1) and so on.. then remove function to remove value
$('#Combobox_id').find("option").eq(0).remove()
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742297575a4417431.html
评论列表(0条)