Make <a> inside jQuery autocomplete clickable
- Dominant language
- No language data
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
I managed to add a link to the right of the jQuery autocomplete items, using the following code:
``` javascript
function onClientSelect(event, ui) {
// My handling code goes here
event.preventDefault();
}
$("#mypage input[name='client']").autocomplete({
minLength: 1,
appendTo: $(this).parent(),
source: '/filter_client/',
select: onClientSelect,
focus: function (event, ui) {
event.preventDefault();
},
}).data("ui-autocomplete")._renderItem = function (ul, item) {
return $("
.data("item.autocomplete", item)
.append("" + item.label + "")
.appendTo(ul);
};
```
My server returns element label in this format:
``` html
View Detail
```
What I want to do is to open the link in a new tab when I click on 'View Detail', which clicking any other area executes onClientSelect just like normal. However, currently left-clicking on the link also executes onClientSelect. The only way to open the link is to click the middle wheel or right mouse button and select 'open in new tab'.
I tried attaching a click event handler on the link with event.stopImmediatePropagation() but that doesn't seem to work. Does anyone have any idea how to fix this?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.