I am facing a small issue with jquery code below.The first if segment of the code is working fine but the else part is not working.
function show_table() {
var table_name = '<?php echo $table_name; ?>';
if(table_name = "users" ) {
$("#users").css('display', 'block');
}else if(table_name = "questions") {
$("#questions").css('display', 'block');
}
}
$(document).ready(function() {
$("#block").click(function() {
show_table();
return false;
});
});
<a id="block" class="btn btn-info fa fa-cog" href=""></a>
<div style="display: none;" id="questions">
<p>Questions</p>
</div>
<div style="display: none;" id="users">
<p>users</p>
</div>
Can any one please help me solve this issue.