/    Sign up×
Community /Pin to ProfileBookmark

Javascript ie issue

Hello,

If there any reason why the following code shouldnt work in ie??

[CODE]function filterSelect(target, text, property){

if(!property) property = ‘label’;

var selectValue = this.childNodes[0].getValue()
var options = this.getElements(‘option’)

//var targetOrig = target.retrieve(‘original’)
//Store off the original values for use later
/* if(!targetOrig){
targetOrig = target.clone(1,1);
target.store(‘original’,targetOrig)
} */

//console.log(this.getElementById(‘Region’).selectedIndex.getText())

var selectText = options[this.childNodes[0].selectedIndex].getText()

//curSelect not used.
var curSelect = target.getValue();

//Reset the target
target.setHTML(targetOrig.innerHTML)
//getElementById(‘cat_id’)

//IE is stupid, it sets the width wrong if we dont set the first el text
if(!selectValue) text = target.getFirst().getText()

//Sets the top select option

target.childNodes[0].getFirst().setText(text.replace(‘%s’,selectText))

//Loop through optgroups and only display child areas
target.childNodes[0].getElements(‘optgroup’).each(function(el){
if(selectValue && el.getProperty(property) != selectText) el.remove()
})

//Reset if current value is null
if(!selectValue){
target.childNodes[0].selectedIndex = 0;
}
}[/CODE]

Thank you for your help.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@pcodauthorAug 21.2009 — Finally got this to work in ie. I tried:

childNodes[0]

getElementById('cat_id')

getElementsByTagName('select')[0]

All of these worked in firefox but not ie, in the end .getElement('select') worked.

?
×

Success!

Help @pcod spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...