javascript - ios - Injecting text into a UIWebView textField - Stack Overflow

Quick question - if a textfield in a webform, does not automatically has the focus set by the form, ie

Quick question - if a textfield in a webform, does not automatically has the focus set by the form, ie you got to press the field before the keyboard pops up - am I correct to assume that field cannot be edited then?

In other words - I cannot set a text for a textField by injecting javascript into it, unless it gets a focus upon loading of the website right?

NOTE: I am not talking about set texts or placeholders here:-)

Cheers

Quick question - if a textfield in a webform, does not automatically has the focus set by the form, ie you got to press the field before the keyboard pops up - am I correct to assume that field cannot be edited then?

In other words - I cannot set a text for a textField by injecting javascript into it, unless it gets a focus upon loading of the website right?

NOTE: I am not talking about set texts or placeholders here:-)

Cheers

Share asked May 8, 2012 at 19:57 jwknzjwknz 6,82417 gold badges76 silver badges117 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

Yes you can! You can use Javascript to set the value:

[theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('textFieldID').value = 'MyText'"]

Here's an article which shows you how to set and get the values of textfields with Javascript.

Hope this helped!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742286543a4415425.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信