I have a div which gets edited on click and edited data is saved back.
Now i was to able get it focused, but somehow not able to select all text and also get the focus at end of text instead at start.
<div class="edit-section">
<a>Name</a>
</div>
<a href='#' class="edit">Edit</a>
jQuery
$('.edit').click(function () {
$(this).siblings('.edit-section').focus();
$(this).siblings('.edit-section').attr('contenteditable', 'true');
$(this).siblings('.edit-section').attr('style', 'border:2px solid;');
});
I tried following but does not seem to work.
$(this).siblings('.edit-section').focus(function () { $(this).select() });
Edit: New to jQuery