What is the difference between XSP.getElementById and document.getElementById? In my tests both seem to return the same value (value stored in field). Which one should be preferred while coding for XPages?
What is the difference between XSP.getElementById and document.getElementById ? In my tests both seem
Share
edited
XSP.getElementByIdis the same asdojo.byIdwhich I believe works in wider range of browsers thandocument.getElementById.Here is the source for
XSP.getElementById:I guess for better future XPage support it might be a good idea to use
XSP.getElementById(because they might change it) instead ofdojo.byId. I’ve been usingdojo.byIdbecause it’s shorter.document.getElementByIdshould never be used in XPages because we havedojo.byId.update
Starting from Dojo 1.7 the syntax is much more complex:
Today my colleque pointed out that Dojo 2 will not support the current simple way of calling
dojo.byIdany more. This means thatXSP.getElementByIdis definitely the way to go and we should start using the newrequirebased syntax whenever we use Dojo with ND9.