2015-06-26 5 views
1

Как удалить стиль = "" из внутренней переменной html?Как удалить стиль тега из html

function printCalendar($scope) { 
    $scope.print = function(){ 
     var data = $('.fc-content').html(); 
     var mywindow = window.open('', 'my div', ''); 
     mywindow.document.write('<html><head><link rel="stylesheet" href="css/printcalendar.css"/></head><body >'); 
     mywindow.document.write(data); 
     mywindow.document.write('</body></html>'); 
     mywindow.document.close(); 
     mywindow.focus(); 
     mywindow.print(); 
    } 
} 

ответ

1

Вы должны сделать это клонированииfc-content - таким образом, вы можете использовать JQuery для выполнения манипуляции:

var $clone = $('.fc-content').clone(); // Clone the element 
$clone.find("[style]") // Find the elements with style attributes 
    .removeAttr("style") // Remove the attribute entirely 
var data = .html(); // Now grab the clone's HTML 
Смежные вопросы