javascript - Focus on next form element directly after button -


how focus on next textarea comes after button clicked?

http://jsfiddle.net/infatti/gmpcz/

$('.add').click(function(){   $(this).closest('div').next('textarea:visible').focus(); }); 

closest() starts current element , searches dom first element matching selector. div want isn't ancestor of link, sibling.

http://jsfiddle.net/8tvxd/

$('.add').click(function(){     $(this).next('div').find('textarea:visible:first').focus(); }); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -