should not use DOM manipulation techniques
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2015 11:39 PM
Hi All,
When we reviewed our code with ServiceNow they told we should not use DOM manipulation techniques in the script, which is a performance issue. But we are using these techniques for making fields read-only, for hiding UI macros and for some other scripts. Please see the below script which we are using for making variables read-only on RITM form and Catalog Task form (we got this from ServiceNow Guru).
function onLoad(){
try{
//Get the 'Variables' section
var ve = $('variable_map').up('table');
//Disable all elements within with a class of 'cat_item_option'
ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
elmt.disabled = true;
});
//Remove any reference or calendar icons
ve.select('img[src*=reference_list.gifx]','img[src*=delete_edit.gif]','img[src*=user_obj.gifx]','img[src*=view_edit.png]','img[src*=view_form.png]','img[src*=small_calendar.gifx]').each(function(img){
img.hide();
});
//Hide list collector icons
ve.select('img[src*=arrow]').each(function(img){
img.up('table').hide();
});
}
catch(e){}
}
Please provide any other alternatives to over come this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2015 01:29 AM
Okay I got it. Thanks for your explanation.