Can this jQuery code snippet be shortened?
Posted
by David Vidmar
on Stack Overflow
See other posts from Stack Overflow
or by David Vidmar
Published on 2010-03-22T12:49:39Z
Indexed on
2010/03/22
12:51 UTC
Read the original article
Hit count: 281
jQuery
|JavaScript
I have just stared using jQuery and although following code gets the job done, I have a feeling that it can be shortened.
var accountAddress = $(document.createElement("input")).addClass("readOnly").attr("contentEditable", "false").attr("id", "d_accountAddress");
$("#customerid_c").next().next().next().append(accountAddress);
If it is not clear - what I'm doing is creating new input tag, assigning class and making it readonly, then positioning new input two TD's to the right of some known text.
© Stack Overflow or respective owner