0

I have a cancel button and upon clicking it needs to remove the said div. My code reads like that

var search_id       = $(this).parent().attr('data-id'); 

// search id is F-R33^:^F-BC12^:^F-N10

$("div[data-id="+search_id+"]").remove();

This line is giving me syntax error, what i think is for ^:^ this expression. how to resolve this?

Rahul Gupta
  • 972
  • 11
  • 29

1 Answers1

0

You can do in this way - give that div a class e.g. divClass

$(".divClass"+search_id).remove();
Or
$(".div"+search_id).remove();