Hello. This is my forum: click it
I need a button in a topic to click to show only the topic starter's posts.
And this is the explanatory diagram by @Winging.
So I have tried like this:
But this code can be worked only in the first page.
I can not find the code which can catch the topic starter. And that is the key to create it.
I hope to get your help here.
Thank you for reading!
I need a button in a topic to click to show only the topic starter's posts.
And this is the explanatory diagram by @Winging.
So I have tried like this:
- Code:
$(function(){
$("#author_only").click(function(e){
e.preventDefault();
var id=$(".postrow").first().find(".poster_name").find("a").text();
id='{TOPIC_POSTER}';
if($(this).hasClass("only")){
$(this).removeClass("only").text("只看作者(It means only see the topic starter's posts)");
$(".postrow").show();
}
else{
$(this).addClass("only").text("顯示其他評論(It means see all posts)");
$(".postrow").map(function(){
if($(this).find(".poster_name").find("a").text()!=id){
$(this).hide();
}
});
}
But this code can be worked only in the first page.
I can not find the code which can catch the topic starter. And that is the key to create it.
I hope to get your help here.
Thank you for reading!