How to add drop menu item for " Version Picker (multiple versions)" field

Hi,
I want to add a button in the Version Picker field’s drop menu ,
like this pictrue,version_picker

somebody know this ? or where can find the guide about this?

ths

somebody konw this ,ths ?

Soooo… even though there’s no web fragment location for this, there’s still a way to do it. However the way that comes to my mind is very fragile and not something that I would put in a marketplace app.

Depending on where your version picker lives you’ll want add a web resource to its context first. So let’s say we’re talking about the issue view then you’ll want to load your web resource like this:

<web-resource name="Cheeky button hack" key="hackery-doodle-doo">
        <resource name="cheeky-hack.js" type="download" location="resources/cheeky-hack.js">
        </resource>
        <context>jira.view.issue</context>
</web-resource>

In your cheeky-hack.js file you can then listen to clicks on your version picker. In my case I’ll listen to the fixVersion one. In that listener you can simply add your button and do whatever you want with it:

AJS.toInit(function() {
	$('#fixfor-val').on('click', function() {
		// The menu is not immediately available after the click so we wait a little...
		
		setTimeout(function() {
			var $menu = $('#fixfor-val .save-options');
		
			if(!$menu.find('#cheeky-hack').length) {
				var $yourButton = $('<button id="cheeky-hack" class="aui-button aui-button-primary"><span class="aui-icon aui-icon-small aui-iconfont-configure"></span></button>');
				
				$yourButton.on('click', function(e){
					e.preventDefault();
					alert('you did it!');
				}).prependTo($menu);
			}
		}, 100);
	});
});

This works pretty well and gives me this result:

But as you can see in the code you’ll have to wait a small amount of time after the click event before the menu becomes available in the DOM (this also makes the UI jump a little). This is super fragile and you might see it break on other peoples machines. You might find a more reliable way using a MutationObserver or something like that but in general relying on modifications to the DOM made by someone else is always a hairy topic. If you’re just using this internally it will probably work this way but if you’re planning on putting this on the marketplace get ready for some unexpected problems.