當使用jQuery的.load
選擇從另一個頁面像如何獲得jQuery的.load()從結果中排除div元素?
<div id="hello"> Hello </div>
我如何得到它排除在結果div標籤一個div?
所以它只是返回「你好」。
更具體地講什麼,我實際上做的是越來越從一個網頁在它的一些HTML一個div並把它放在另一個。
<script>
$(document).ready(function(){
$('.backup').on('click',function(e){
var id = $(this).attr('id');
var file_name = "../ajax/"+{{ json_encode($data[0]) }} + " #" + id + ".text";
console.log(file_name);
//this is .load it takes in a string with a URL and a DOM element as a string.
// it will take the dom element found at the URL and place it in .page_text
$(".page_text").load(file_name);
});
});
</script>
什麼負載,什麼的div,來自哪裏?沒有代碼? – adeneo
無論如何,在編輯它之前,使用'$ .get'並獲取像'$(data).find('#hello')。text()' – adeneo
使用恰當的語法 – Mahi