Pergunta

I have a webview that is displaying a page that looks like a calendar and on that calendar are events that are buttons which can be single or double-clicked - single/double calling a different function. Note: I cannot change the coding of this page. Here is a snippet of a button: <div class="boardpiece clickable" onclick="selectPairing(event, this);" id="sn_18067063" The ID for the button is dynamic - or will always be unknown - so I cannot use it in my coding. The classes of the items I need my clicks to work on, however, are known.

Now, there are only a few classes of buttons here so I can designate what to do for each class if that is a solution. I think I saw a question/answer saying that you may be able to identify the element by an HTML attribute? Something like "If outerHTML contains "boardpiece clickable" Do function "selectPairing" ..." That's my train of thought at least.

Or am I going about this the wrong way? I simply need to call the onclick functions of these elements if the user clicks (taps) on the element. If I were creating the buttons myself, that would be simple. I think I can set a stop function in my onClick so that only the one button is activated since they all have the same class.

~ Dan

Foi útil?

Solução

If you want to perform any operation on a HTML page inside a web view then you have to modify the code. you need to set onClick event of a button using JavaScript or you have to get element from the HTML page based on the ID.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top