You need to sign in to do that
Don't have an account?
ehrenfoss
Execute javascript within {!Component } lookup
I'm trying to dynamically access a set of VisualForce elements:
function addClassToFields(string, class){
ids = string.split(',');
for(var x=0;x<ids.length;x++){
obj = document.getElementById(ids[x]);
if (obj) {
classname = obj.className;
obj.className = classname + ' ' + class;
}
}
}
This function receives a set of IDs, comma separated, and tries to add an additional style class to them. I know the recommended method for looking up the actual IDs is something like
obj = document.getElementById({!$Component.lookingForThisId});
is there any way to drop back into Javascript within {! }, so I can append the ID I want to $Component....? Something like
var myid = 'fieldName';
obj = document.getElementById({!Component.jsExec('myid')});
Maybe?
function addClassToFields(string, class){
ids = string.split(',');
for(var x=0;x<ids.length;x++){
obj = document.getElementById(ids[x]);
if (obj) {
classname = obj.className;
obj.className = classname + ' ' + class;
}
}
}
This function receives a set of IDs, comma separated, and tries to add an additional style class to them. I know the recommended method for looking up the actual IDs is something like
obj = document.getElementById({!$Component.lookingForThisId});
is there any way to drop back into Javascript within {! }, so I can append the ID I want to $Component....? Something like
var myid = 'fieldName';
obj = document.getElementById({!Component.jsExec('myid')});
Maybe?