Athapali
Athapali

Reputation: 1089

jquery prepend to a div html file content

How to do this

$('#RibbonContainer-TabRowRight').prepend(load('~/_layouts/1033/nav.html'));

Something like this instead of :

$('#RibbonContainer-TabRowRight').prepend('<div style="padding-bottom:3px;background:#fff; color:white!important; float:left; margin-right:20px; line-height:40px;"><a style="padding:0 20px; border:1 green solid;" href="#">Sitemap</a> <a style="padding:0 20px; border:1 green solid;" href="#">Help</a><a style="padding:0 20px; border:1 green solid;" href="#">Welcome!</a></div>');

Upvotes: 1

Views: 946

Answers (2)

AT_
AT_

Reputation: 11

$.get("../_layouts/1033/nav.html", function(r){
    $("#RibbonContainer-TabRowRight").append(r);
});

This will not replace and execute script if required.

Upvotes: 0

Dhamu
Dhamu

Reputation: 1752

Just use the function .load()

like this

$('#RibbonContainer-TabRowRight').load('/_layouts/1033/nav.html');

Upvotes: 1

Related Questions