SORU
26 EKİM 2009, PAZARTESİ


Seçme jQuery ile Yorum HTML

Herhangi bir jquery ile html yorumlarını seçmek için nasıl biliyor mu?

<html>
<head>
    <title>Check Test</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $("body *").each(function() {
                alert($(this).wrap("<span />").parent().html());
            });
        });
    </script>
</head>
<body>
    <!-- Hello -->  
    <p>
        <label for="thing">Thing Label</label>
        <input id="thing" type="checkbox" />
    </p>

Bu yoruma cevap vermez

CEVAP
8 EYLÜL 2010, ÇARŞAMBA


Bu bir şey aradığınızı eşdeğer gibi görünüyor:

    $(function() {
        $("body").contents().filter(function(){
            return this.nodeType == 8;
        }).each(function(i, e){
            alert(e.nodeValue);
        });
    });

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • George McCarron

    George McCar

    29 Mayıs 2013
  • thepoke64738

    thepoke64738

    17 HAZİRAN 2011
  • Tire Rack

    Tire Rack

    31 Mayıs 2007