-3

Here i am checking parent id of the removal attribute.so how to merge this code with string.

var parentId = $(this).parent().parent().attr('id');
$("#"+parentId ".medicinetype-allergies input[type=checkbox]").removeAttr('checked');
Ben Fortune
  • 31,623
  • 10
  • 79
  • 80
user3222157
  • 125
  • 2
  • 17

2 Answers2

0

That should works:

$( "#" + parentId + " .medicinetype-allergies input[type=checkbox]" ).removeAttr('checked');

Note: You missed the second + operator, which is used to concatenate strings. And don't forget to separate different selectors by space.

Kristian Vitozev
  • 5,791
  • 6
  • 36
  • 56
0

Please make sure of '+' operator for your selector

 var parentId = $(this).parent().parent().attr('id');
 $("#"+parentId+".medicinetype-allergies input[type=checkbox]").removeAttr('checked');
guvenckardas
  • 738
  • 4
  • 8