سؤال

في الكروم وظيفة ولكن في IE10 عودة خطأ اسم المتغير في الدالة, كيف يمكنني الوصول إلى هذا المتغير من خلال وظيفة ؟

  $('.kpit').on('click', function() {        
        var url = $(this).attr('id');
        var name = $(this).attr('href');
        $('.kpi').html('');
        $.post(url, {idKpi: id}, function(result) {
            $(name).html(result);
        });
  });
هل كانت مفيدة؟

المحلول

محاولة:

 $('.kpit').on('click', function() {        
        var name = $(this).attr('id');
        var element = $(this); //Removed the .attr('href'), as that would store the URL, not the element.

        $('.kpi').html('');
        $.post(name, {idKpi: id}, function(result) {

        $(element).attr('href',result); //Set the HREF by using .attr, not .html
        });
  });

انظر إعداد السمة href في وقت التشغيل

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top