In javascript, is what is the difference between setting an HTMLElement property with assignment as versus using setAttribute()
. The following is from a chrome session, leading me to believe there is a difference:
> i = document.createElement('input'); <input> > i.value = 'abc'; "abc" > i <input> > i.setAttribute('value','abc'); undefined > i <input value="abc">
What exactly is the difference? Is it the type of thing that bytes you in the ass?
answer right on.
chrome displays attributes, so this led to my confusion.