I don’t know if I am doing this correctly and would like some advice please.
var housetype = '<?php print strtolower($item->post_title); ?>';
$(".outside-link").click(function() {
$(".nav li").removeClass("active");
$(".tab-pane").removeClass("active");
$($(this).attr("data-toggle-tab")).parent("li").addClass("active");
$("#showhome"+housetype).addClass('active fade in');
});
I have a list of housetypes. Each has a name or “post_title”. I have a button at the top of the page and I want to use that to select a tab at the bottom of the page.
I need to use the housetype post_title to find the correct tab i.e “showhomehousetitle” is the name of the correct tab, so I am trying to use PHP to call the name, but I just get this error:
Error: Syntax error, unrecognized expression: #showhome<?php print strtolower($item->post_title); ?>
I know I am probably doing this completely the wrong way, but I just can’t work out what to do.
Update. This is a WordPress site and I am using an external js file which I have enqued in functions.php. Don’t know if that helps clarify.