Search code examples
javascriptjqueryvb.netvisual-studiogeckofx

VB.net Geckofx 45 executing jquery.hide() has no effect


I tried the following articles about executing javascript.

But the if-else statement seems not obtaining the capability of jquery.

     Dim jQuery As JQueryExecutor
        jQuery = New JQueryExecutor(GeckoWebBrowser1.Window)

      If (jQuery.ExecuteJQuery("typeof jQuery == 'undefined'").ToBoolean) Then
    MsgBox("no jquery here")
else
jQuery.ExecuteJQuery("$(#" + aName + ").hide();")
    end if

Is that something i forgotten? The error is this oneenter image description here


Solution

  • I'm not entirely sure if this is what is triggering the error, but it looks as if your jQuery syntax is faulty; you are selecting by an ID, which jQuery takes as a string parameter, but your .ExecuteJQuery() line does not include the # as a string.

    jQuery.ExecuteJQuery(jQuery.ExecuteJQuery("$('#" + aName + "').hide();")
    

    I know quotes can get a bit confusing, and perhaps this might be the issue?