1

I've loaded a webpage into my UIWebView and the page contains a number of input tags. I want to identify the one that looks like:

<input name="j_username" type="text" tabindex="1" />

Do you know what I would write in stringByEvaluatingJavaScriptFromString?

Thanks!

1
  • What do you mean identify? document.querySelector("input[name=j_username]")? Commented Nov 15, 2012 at 0:20

1 Answer 1

1

I would use document.getElementsByName:

NSString* jsString = @"var myElement = document.getElementsByName(\"j_username\")[0];";
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.