Hi Phil,

#elem1 must already have tabindex set <input id="elem1" tabindex="1" />

$(e).attr('tabindex') returns a string, so you should multiply it by 1 to
convert it to a number, otherwise #elem2 will end up with a tabindex of "11"

$("#elem2").attr("tabindex", $("#elem1").attr("tabindex")*1+1);

Cheers,
Brian.

On 7/18/07, Phil Glatz <[EMAIL PROTECTED]> wrote:


I have some fields that may be generated on the fly via DOM, and want
to set the tab index. This isn't working for me:

  $("#elem2").attr("tabindex", $("#elem1").attr("tabindex") + 1);

What would the correct syntax be to make the tabindex of elem2 to be
that of elem1 + 1?


Reply via email to