I have the following code, which has a function converting a Jira Multi-Select Customfield to Autocomplete Renderer: https://confluence.atlassian.com/jirakb/how-to-enable-autocomplete-renderer-for-multi-select-custom-field-in-jira-754978239.html
The Jira context etc. is not so relevant here, however, the only thing I try and fail to achieve is to add a simple placeholder text to the Dropdown. The placeholder should be there when the Dropdown has no value selected.
Can someone help? I can’t imagine it to be that difficult if you are familiar with the syntax.
<script type="text/javascript">
(function($) {
function convertMulti(id){
if (AJS.$('#'+id+"-textarea").length == 0){
new AJS.MultiSelect({
element: $("#"+id),
itemAttrDisplayed: "label",
errorMessage: AJS.params.multiselectComponentsError,
});
}
}
AJS.toInit(function(){
convertMulti("customfield_16043");
})
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
AJS.$("#customfield_16043 option[value='-1']").remove();
convertMulti("customfield_16043");
});
})(AJS.$);
</script>
in the following section of the code snippet, I tried several things to add a placeholder. However, I am not familiar enough with javascript/jquery and I failed to succeed here.
new AJS.MultiSelect({.....})