What is the difference in var callerLabel = \$('label.incident.caller_id').down('label'); and var callerLabel = \$('label.incident.caller_id');

rao_palak
Kilo Contributor

I was not able to set background image on callerLabel however when i   used   $('label.incident.caller_id).down('label') it worked.What is the difference in the two???

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You're using prototype to target html elements on the page. $('label.incident.caller_id') would get you the element with id="label.incident.caller_id". Using .down('label') walks down the element tree from your original element to find the first label type element and target that element.



Prototype v1.7.3 API documentation | Element#down


View solution in original post

1 REPLY 1

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You're using prototype to target html elements on the page. $('label.incident.caller_id') would get you the element with id="label.incident.caller_id". Using .down('label') walks down the element tree from your original element to find the first label type element and target that element.



Prototype v1.7.3 API documentation | Element#down