I am writing jira-plugin and I need to edit customfield on create issue screen. I use jQuery to do this. I have a problem with jQuery hide / show methods used on html select in Chrome (under Firefox works well). The problem is I have 3 different select-boxes which options depends on the option selected in the previous one. I have a function to prepare the next select list when the previous one changed.
function prepareList(code, list) {
list.children('option').each(function() {
if(jQuery(this).text() == code || jQuery(this).text() == 'None') {
jQuery(this).show();
}
else {
jQuery(this).hide();
}
});
}
code is a string which is jQuery('#previous_select option:selected').text()
It works fine in many cases but sometimes it resizes the option list. Worse thing is that when the next list has only one option it is not displayed. I can see it has display: inline in html code but after I click on select triangle the dropdown list has like 2 px.
Funny fact is that it works perfectly in Firefox.
IE 8 is not even hiding/showing but it is just IE so I can understand this.
Opera 12.16 is not hiding / showing also.
Safari 5.1.7 for Windows is not hiding / showing too.
The question is which methods should I use to achieve my goal? I tried jQuery(this).css('display', 'none/inline') too and its not working also.
EDIT: JSFiddle: jsfiddle.net/7KRLE/
**EDIT**. Reload the fiddle and try it on the 4th option from first menu. – patrykf Dec 12 '13 at 11:53