N
Netzwerkidi
Hi,
wie selektiere ich denn mit jQuery Teile des Parent-Elements? Hier das Testscript:
Grüße
Idi
wie selektiere ich denn mit jQuery Teile des Parent-Elements? Hier das Testscript:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv='Content-Language' content='de-DE' />
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div>div1
<script> // </script>
<style> /* */ </style>
<div>div1.1
</div>
<div class="divClass">div1.2
</div>
</div>
<div>div2
</div>
<script>
// Ist: gesamten div1-Inhalt
alert($('div .divClass').parent().html());
// SOLL: Wie Ist, aber ohne das Script
alert($('div .divClass').parent().html());
// SOLL: Wie Ist, aber ohne das Stylesheet
alert($('div .divClass').parent().html());
</script>
</body>
</html>
Grüße
Idi