Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
$(".bla.blu")
Laut Doku geht das.
getElementsByClassName
Schon mal über jQuery nachgedacht?Soll aber laut Manual auch nur die native getElementsByClassName()-Funktion aufrufen. Vielleicht verwendest du nur einen Browser, der es nicht kann?PHP:$(".bla.blu")
<tr><td><div id="bla"></div></td></tr>
also ich erinnere mich an einen Fall, wo ich im IE den Inhalt von Tabellen nicht modifizieren konnte. Es ging nur wenn die Tablerows in einem Tbody steckten.
Genauen Sachverhalt weiß ich aber nicht mehr
Ne, innerHTML kann man nicht auf Tabellen anwenden, laut SelfHTML, deshalb frag ich ja hier ^^Klar, warum sollte es auch nicht funktionieren. Das <div> kannst du eigentlich weglassen, wenn du es bisher nur für die ID benutzt hast.
Code:<tr><td id="bla"></td></tr>
Was ist mit meinem Ansatz ein Div-Element in die Tds einzubauen?danke für den Link, ich glaube genau das war das
table.innerHTML funktionierte nur, wenn ich tbody nutzte und dann eben nur für alle Daten innerhalb des tbody.
<table>
<tbody>
<tr></tr>
</tbody>
</table>
hi
ich gebe mal ein Anreiz
Wer Seth93 als erstes eine Lösung zeigt, die dann auch später funktioniert in den Explorer, bekommt von mir 100 Mill. Lose.
Oder hat jQuery dafür eine Lösung? Denn dann würde ich eventuell doch jQuery nutzen.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<table id="t1">
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
<script>$("#t1").html('<tr><td>3</td><td>4</td></tr>');</script>
<table>
<tr id="tr1">
<td id="td1">a1</td>
<td id="td2">b2</td>
</tr>
</table>
<script>$("#tr1").html('<td id="td3">a3</td><td id="td4">b4</td>');</script>
<table>
<tr>
<td id="td5">a5</td>
<td id="td6">b6</td>
</tr>
</table>
<script>$("#td6").html('<strong>b7</strong>');</script>
</body>
</html>
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
Auf Tabellen nicht, auf Tabellen-Zellen aber doch. Der verlinkte Microsoft-Artikel sagt doch auch nichts anderes. Die Tabelle selbst möge man doch brav als Baum anlegen (mit appendChild und Co), den Inhalt einer Zelle darf man aber doch mit innerHTML ändern...Ne, innerHTML kann man nicht auf Tabellen anwenden
<table>
<tr>
<td id="blubb">
<a href="#" onclick="document.all.blubb.innerHTML='geht doch'">und nun?</a>
</td>
</tr>
</table>
Auf Tabellen nicht, auf Tabellen-Zellen aber doch. Der verlinkte Microsoft-Artikel sagt doch auch nichts anderes. Die Tabelle selbst möge man doch brav als Baum anlegen (mit appendChild und Co), den Inhalt einer Zelle darf man aber doch mit innerHTML ändern...
PHP:<table> <tr> <td id="blubb"> <a href="#" onclick="document.all.blubb.innerHTML='geht doch'">und nun?</a> </td> </tr> </table>
IE7 hab ich gerade keinen greifbar, im IE8 klappt es aber zumindest...Also bei mir klappt es im IE 7 nicht, bei dir?