javascript - 单击链接时如何在特定的div中添加文本

原文 标签 javascript jquery

How to add a text in a certain div when click in a link

This is my first incursion in jQuery so I am really newbie with this. I read the documentation (actually, I am still on it) to get to know it better!

The thing is that I have a website with several links into a li element and I want to achieve that every time I click in one of these links, a certain piece of text will appear in a div id="container" in the webpage.

How could I do this?

$('li a').click(function(){
   $('#container').html('Text you want to add');



问题是,我有一个网站,其中的li元素带有多个链接,并且我希望每次单击这些链接中的一个时,都会在网页的div id =“ container”中显示一段特定的文本。

$('li a').click(function(){
   $('#container').html('Text you want to add');

javascript - XSS:还是有问题吗?

javascript - IE中的XSS-旁路方法?

javascript - 用Javascript提交表单

javascript - 内联javascript firefox错误?

javascript - 如何在jQuery中延迟ajax调用?

javascript - 使用jQuery从两个值中获取两个值

javascript - 如何像Javascript一样调用Python函数

javascript - jQuery交互式地图库? [关闭]

javascript - 使用JavaScript解析.obj 3D图形文件

jquery - 滚动jQuery问题。如何自动滚动onclick到div