as title suggests. id string is passed to view as ViewData variable.
That will trigger the focus event handlers, but it won't actually call the focus() method on the underlying object.
tvanfosson
2009-08-11 21:48:46
@tvanfosson you're right, i fixed that.
Rex M
2009-08-11 21:49:34
It's weird that the documentation says one thing, but they have an example that does the opposite. In retrospect, I'd say, maybe try the focus() method on the jQuery object itself and see if it works.
tvanfosson
2009-08-11 21:53:18
Note: even if it works, it will probably only work for an input element. Not every DOM object supports the focus method.
tvanfosson
2009-08-11 21:55:55
@tvanfosson yeah, I've done something like this in the past but now that I've let it sit on my brain for a few minutes I'm not so sure if this was it.
Rex M
2009-08-11 22:00:58
fyi couldnt get this to work, but plugin below did.
zsharp
2009-08-14 20:41:57
@zsharp glad you got it working! I recommend accepting that answer, then.
Rex M
2009-08-14 21:42:44
+3
A:
Looks like there is a nice plug-in for jQuery available to do just that here: http://flesler.blogspot.com/2007/10/jqueryscrollto.html
Kyle B.
2009-08-11 21:48:21
A:
You could also append the ID to the URL using the hash:
http://www.someurl.com/page.html#the_id
Philipe Fatio
2009-08-11 21:50:11
Works if it's an anchor, but not if it is any generic element on the page.
tvanfosson
2009-08-11 21:53:48
Presumably this is also on the rendering side which would mean that you'd have to redirect to the new url and process the request again, but this time with the tag.
tvanfosson
2009-08-11 22:01:22
anchor like `<a name="test"></a>`? It works with every ID on the page.
Philipe Fatio
2009-08-12 05:33:47