How to simulate a variable that clicks a hyperlink in js?

in js there is the following variable s = " (5.5.0.27) "
how to simulate clicking this hyperlink in js?

Mar.14,2021

just found that it was originally obtained as a string

two methods:

1. Insert this string into the page

var dom = $("<a id="test" href="javascript:void(0)" onclick="show_float_panel('/monitor/onlinecntstatis/detail/5.5.0.27/')">(5.5.0.27)</a>");
// id
$('body').append(dom);

then use $('- sharptest'). Click () / / or $('- sharptest'). Trigger ('click') to trigger.

After
triggers the click event, the browser will pass the variable automatically, so you don't have to worry about it.

2. Extract show_float_panel ('/ monitor/onlinecntstatis/detail/5.5.0.27/') with regularity, and then execute

with eval

in fact, all you have to do is change the string into a dom object of DOM or jq, and you don't have to append it to the page.

the simplest thing is to use $(s). Click (); directly, of course, as long as a pile in the string is correctly parsed into the corresponding DOM object.

Menu