How C # Cefsharp dynamically add ul-> li

1. First you are able to correct the visual studio 2019 or 2017 installed in C # WPF's Cefsharp, you can look at this.

https://www.jianshu.com/p/87d5311c7ff4

2. Let's create a button, set the action is clicked, the following will add a li id ​​is "ul" is.

 

 

private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string script = "document.getElementById('ul').innerHTML+='<li>多喝热水</li>'";
            JavascriptResponse response = await b1.EvaluateScriptAsync(script);
            
        }

 

 ! ------------ specific principle is to use JavaScript, to obtain the object based on ID, then add li entire statement can appear,

According to this, you can dynamically customize li, are String, pay attention to string concatenation like

Guess you like

Origin www.cnblogs.com/alpha-cat/p/12635345.html