0
我想爲我的所有標籤添加iframe屬性目標。爲所有標籤添加iframe具有屬性目標
我使用此代碼。
jQuery(window).load(function(e) {
jQuery('a[target]').each(function(index, element) {
var targetLink= jQuery(this).attr('target');
alert(targetLink);
var newIframe=jQuery('<iframe src="" width="400" height="auto" name='+targetLink+' frameborder="0"></iframe>')
newIframe.appendTo(jQuery('div#myMain'));
});
但我在控制檯
TypeError: a.indexOf is not a function[Learn More]
我怎樣才能解決這個問題得到錯誤?
哪一行完全拋出一個錯誤? –
如果你使用的是jQuery 3.0,'load()'已經被刪除](https://jquery.com/upgrade-guide/3.0/#breaking-change-load-unload-and-error-removed)。請參閱[jquery 3.0 url.indexOf錯誤](http://stackoverflow.com/questions/37738732/jquery-3-0-url-indexof-error)。 – showdev