how to intercept Button click inside UIWebview on IOS?

You can do the following: In your HTML <a class=”yourButton” href=”https://stackoverflow.com/questions/10992339/inapp://capture”>Button Text</a> In your UIWebViewDelegate – (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([request.URL.scheme isEqualToString:@”inapp”]) { if ([request.URL.host isEqualToString:@”capture”]) { // do capture action } return NO; } return YES; } I added “capture” to your button’s URL so that you could distinguish between several … Read more

Change Button color onClick

There are indeed global variables in javascript. You can learn more about scopes, which are helpful in this situation. Your code could look like this: <script> var count = 1; function setColor(btn, color) { var property = document.getElementById(btn); if (count == 0) { property.style.backgroundColor = “#FFFFFF” count = 1; } else { property.style.backgroundColor = “#7FFF00” … Read more

Prevent onclick action with jQuery

jQuery is not going to solve this one OOTB. It can help, but none of stopPropagation, stopImmediatePropagation, preventDefault, return false will work if you simply attach them to the element. You need to override the element’s click handler. However you state in your question “without removing onclick actions”. So you need to override the default … Read more

Calling onclick on a radiobutton list using javascript

How are you generating the radio button list? If you’re just using HTML: <input type=”radio” onclick=”alert(‘hello’);”/> If you’re generating these via something like ASP.NET, you can add that as an attribute to each element in the list. You can run this after you populate your list, or inline it if you build up your list … Read more

Using onClick attribute in layout xml causes a NoSuchMethodException in Android dialogs

Define the method (dialogClicked) in Activity. And modify TestDialog like the following code: public class TestDialog extends Dialog { Context mContext; public TestDialog(final Context context) { super(context); mContext=context; } @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll=(LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.dialog, null); setContentView(ll); } } I think it works 🙂

JavaScript: Invoking click-event of an anchor tag from javascript

If you have jQuery installed then why not just do this: $(‘#proxyAnchor’)[0].click(); Note that we use [0] to specify the first element. The jQuery selector returns a jQuery instance, and calling click() on that only calls click javascript handler, not the href. Calling click() on the actual element (returned by [0]) will follow the link … Read more

OnItemClickListener using ArrayAdapter for ListView

Use OnItemClickListener ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) { String value = (String)adapter.getItemAtPosition(position); // assuming string and if you want to get the value on click of list item // do what you intend to do on click of listview row } }); … Read more

tech