Пример:
Вставить код HTML после всех параграфов.
"HTML"
I would like to say:
"CSS"
p { background:yellow; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").after("<b>Hello</b>");
});
</script>
</head>
<body class="iframe">
I would like to say:
</body>
</html>
<style>
p { background:yellow; }
</style>
Пример:
Вставить DOM элемент после всех параграфов.
"HTML"
<b>Hello</b>I would like to say:
"CSS"
p { background:yellow; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").after( document.createTextNode("Hello") );
});
</script>
</head>
<body class="iframe">
<b>Hello</b>
I would like to say:
</body>
</html>
<style>
p { background:yellow; }
</style>
Пример:
$("p").after( $("b") );
"HTML"
I would like to say:
"CSS"
p { background:yellow; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").after("<b>Hello</b>");
});
</script>
</head>
<body class="iframe">
I would like to say:
</body>
</html>
<style>
p { background:yellow; }
</style>
Пример:
$("p").after( $("b") );
"HTML"
I would like to say:
"CSS"
p { border: 2px solid blue; }
newelement { background:yellow; margin:4px; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('p').after(function() {
return '<div class="newelement" >Новый элемент</div>';
});
});
</script>
</head>
<body class="iframe">
I would like to say:
</body>
</html>
<style>
p { border: 2px solid blue; }
newelement { background:yellow; margin:4px; }
</style>