I'm using Bootstrap tooltip through attribute selector. i.e any element has `title` attribute should be rendered as a tooltip:

```
$('[title]').tooltip({placement: 'bottom', trigger: 'hover'});

```

However, for some reasons and for some elements I would like to change the placement. Originally, I did not used `data-placement` attribute for the elements, but for elements that I want its tooltip to have diifirent placement other than the default, I supplied them with `data-placement` attribute and I modified the above code to be like the following:

```
$('[title]').tooltip({placement: (typeof $(this).attr('data-placement') === 'undefined')? 'bottom' : $(this).attr('data-placement'), trigger: 'hover'});

```

This code should set the placement to be `bottom` for elements that has no `data-placement` attribute, while set it equals to its value for elements that has that attribute.

However, the code does not work as expected, it set placement = bottom for every element even,for example, those has `data-placement='right`