Brian Cherne wrote:
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.
Just had the idea to not having to rely on #elem1 having the tabindex
attribute and fallback instead:
$("#elem2").attr("tabindex", (parseInt($("#elem1").attr("tabindex")) ||
0) + 1);
--Klaus