html Popover引用和引号错误的位置?

Im having an issue with the structure of a popover. When the popover is structured like the below, it flows as designed but Im missing an ID in the onclick function.

<td align="center"><input type="image" data-placement="left" data-toggle="popover" style="height:25px; width:25px" src="<?php echo ABSPATH; ?>/uploads/settings_icon.png" data-content='<a style="cursor: pointer;" onclick="test();">Delete</a>' ></td>

When I add the missing ID into the onclick function as mentioned, it breaks the button. Please see the below code...

<td align="center"><input type="image" data-placement="left" data-toggle="popover" style="height:25px; width:25px" src="<?php echo ABSPATH; ?>/uploads/settings_icon.png" data-content='<a style="cursor: pointer;" onclick="test(**'<?php echo $id;?>'**);">Delete</a>' ></td>

This is the outcome of the above line... Any help would be greatly appreciated.

Image here

You need to escape your quotes inside the test() function call. You're already inside some single quotes that are used for the data-content attribute you're defining. When you use your first single quote inside the test() call, you're effectively ending the data-content attribute.

This question might help you further.

I don't think that it is necessary to echo $id within quotes. Try:

<td align="center"><input type="image" data-placement="left" data-toggle="popover" style="height:25px; width:25px" src="<?php echo ABSPATH; ?>/uploads/settings_icon.png" data-content='<a style="cursor: pointer;" onclick="test(**<?php echo $id;?>**);">Delete</a>' ></td>