首页 > 解决方案 > My file name is the same as my menu name. jquery takes the file name when I click the menu name

问题描述

my file name is the same as my menu name.how jquery takes the file name when I click the menu name?

$(document).ready(function() {
$('#mySidenav > a').on('click', function () {
  var linkText = $(this).text().toLowerCase();
  $("#isi").load("./"(linkText),".html");

  $.get("./"(linkText),".html", function(data) {
     $("#isi").html(data);
  });
  console.log(linkText);
  return false;

 });
 });

标签: javascriptjquery

解决方案


 $(document).ready(function() {
  $('#mySidenav > a').on('click', function () {
  var linkText = $(this).text().toLowerCase();
  $("#isi").load("./"+linkText+".html");

  $.get("./"+linkText+".html", function(data) {
    $("#isi").html(data);
  });
  console.log(linkText);
  return false;

  });
 });

推荐阅读