问题
I need to replace the 4th line in -
this.menu = $("<ul>")
.addClass("ui-autocomplete")
.appendTo(this.document.find(this.options.appendTo || "body")[0])
.zIndex(this.element.zIndex() + 1) // !! <- here // !!
.hide()
.data("menu");
with the following code -
if (XXX.style.setProperty) { // IE 9- does not support...
XXX.style.setProperty ("z-index", (this???.element.zIndex() + 1), "important");
}
- How do I merge this code?
- what is 'XXX' in my case?
- what is "this" ?
[relates to How to add 'important' to zIndex ]
回答1:
This should do it:
this.menu = $("<ul>")
.addClass("ui-autocomplete")
.appendTo(this.document.find(this.options.appendTo || "body")[0])
.each(function() {
this.style.cssText+= 'z-index: '+(parseInt($(this).css('z-index'))+1)+' !important';
})
.hide()
.data("menu");
来源:https://stackoverflow.com/questions/30556847/how-to-add-if-to-jquery-chain-code