C# 通过单击“联机”按钮显示更多信息更多

C# 通过单击“联机”按钮显示更多信息更多,c#,jquery,webforms,C#,Jquery,Webforms,我有一个jquery函数,单击more链接时,我会显示指定摘要的更多信息。 我对jQuery还比较陌生,我希望能找到一个指针,指出我哪里出了问题,因为它不能正常工作 $(document).ready(function () { $('#more').on("click", function () { "$('#more').hide(); $('#content').show();" }); }); 这是我关于代码隐藏的C#代码 topicGenerator.Inne

我有一个jquery函数,单击more链接时,我会显示指定摘要的更多信息。 我对jQuery还比较陌生,我希望能找到一个指针,指出我哪里出了问题,因为它不能正常工作

$(document).ready(function () {
$('#more').on("click", function () {
      "$('#more').hide(); $('#content').show();"
    });

});
这是我关于代码隐藏的C#代码

 topicGenerator.InnerHtml += summary.Substring(1, 100);
 topicGenerator.InnerHtml += "<a href='#' id='more'> more...</a>";
 topicGenerator.InnerHtml += "<div id='content' style='display:none;'>"+summary+  </div>";
topicGenerator.InnerHtml+=summary.Substring(1100);
topicGenerator.InnerHtml+=“”;
topicGenerator.InnerHtml+=“”+摘要+”;

亲切问候

这将在显示和隐藏之间切换,并将
更改为“少”再更改为“多”

$(document).ready(function () {
    $('#more').click(function () {
          $('#content').toggle();
          if($('#more').html()=='more...'){
          $('#more').html('less...');
    }else{
          if($('#more').html()=='less...'){
          $('#more').html('more...');
    }      
    }

        });

    });
试着改变

"$('#more').hide(); $('#content').show();"

您不需要将这些语句包装在
“引号”

您还可以将
.hide()
.show()
压缩为
.toggle()


$(函数(){
$(“#更多”)。单击(函数(){
$(“#内容”).toggle();
});
});

请参阅。

并注意在html中的“更多…”之前留下的空间
$('#more').hide(); 
$('#content').show();
<script>
$(function(){
  $("#more").click(function(){
    $("#content").toggle();
  });
});
</script>