Android Question ( Closed ) jQuery to B4A?

anOparator

Active Member
Licensed User
Longtime User
I use jQuery to get the alt attributes of an image map as a String:
B4X:
<script >
   $(document).ready(function () {
        $("area").click(function (e) {
            $("#xMap").val($(this).attr("alt"));                               <!-- How to Send the alt attribute value to B4A -->
            e.preventDefault();
        });
    });
   </script>
but this is all Html.
I'm trying to get the alt attribute value from WebView1 into 'Sub ProcessHTML' or 'Sub JavascriptCallback' before I remove the textBox that currently displays this value.
I may have already read an article on How To, without understanding.
Thanks in advance for all tips.
 

Attachments

  • Sub ProcessHTML.zip
    123.2 KB · Views: 312

walterf25

Expert
Licensed User
Longtime User
I use jQuery to get the alt attributes of an image map as a String:
B4X:
<script >
   $(document).ready(function () {
        $("area").click(function (e) {
            $("#xMap").val($(this).attr("alt"));                               <!-- How to Send the alt attribute value to B4A -->
            e.preventDefault();
        });
    });
   </script>
but this is all Html.
I'm trying to get the alt attribute value from WebView1 into 'Sub ProcessHTML' or 'Sub JavascriptCallback' before I remove the textBox that currently displays this value.
I may have already read an article on How To, without understanding.
Thanks in advance for all tips.
Have you seen this post
https://www.b4x.com/android/forum/t...from-jquery-with-websocket.55576/#post-350209

Regards,
Walter
 
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
Ok, this is either B4J specific OR/AND I am still clueless.
I tried this and other combinations
B4X:
Sub WebView1_PageFinished (Url As String)
   Javascript="B4A.CallSub('Update_Label', true, document.documentElement.innerHTML)"
...
...
End Sub
B4X:
Public Sub Update_Label("alt" As String)
'Get the slider value and update the label
   Dim "alt" As String = ("alt")
   Label1.Text=("alt")
   Log("Label1.Text = " & ("alt"))
End Sub
My Html textBox still gets updated with the 'alt attribute Value' of each Image Map hotspot clicked, and no errors logged.
 
Upvote 0
Top