Menulis Element Terlarang di Kotak Komentar Blog

Tidak semua script di kotak komentar dapat ditulis, tetapi dengan menggunakan kode dibawh ini kita dapat menuliskan element terlarang tersebut termasuk menyisipkan gambar, blockquote, tag pre dan lain-lain. berikut ini langkah-langkahnya :

Baca juga : Langkah Memasang Syntax Hightlighter di Blog

Copy dan paste kode dibawah ini tepat diatas  </body>

<script type='text/javascript'>
//<![CDATA[
$('#comments p, #comments dd').each(function() {
   $('b[rel^="h"]', this).nextAll().filter('br').remove();
    $('i[rel="pre"]', this).replaceWith(function() {
        return $('<pre></pre>').append($(this).contents());
    });
    $('i[rel="image"]', this).replaceWith(function() {
        return $('<img />').attr('src', $(this).text());
    });
    // Menyisipkan tag `<h3>`
    $('b[rel="h3"]', this).replaceWith(function() {
        return $('<h3></h3>').append($(this).contents());
    });
    $('b[rel="quote"]', this).replaceWith(function() {
        return $('<blockquote></blockquote>').append($(this).contents());
    });
    $('i[rel="code"]', this).contents().unwrap().wrap('<code></code>');
});
//]]>
</script>

Untuk menggunakannya dengan kode dibawah ini :

Menyisipkan kode:  <i rel="code">Kode Anda</i> atau <i rel="pre">Kode Anda</i>

Menyisipkan gambar:  <i rel="image">Link Gambar Anda</i>
Menyisipkan judul:  <b rel="h3">Judul Anda.</b>
Menyisipkan catatan:  <b rel="quote">Catatan.</b>
Membuat teks tebal:  <b>Teks Anda.</b>
Membuat huruf miring:  <i>Teks Anda</i>

Selamat mencoba semoga sukses.

Untuk demo bisa dilihat pada kotak komentar dibawah

2 Comments

[+] Silahkan tinggalkan komentar
[+] Berkomertarlah dengan santun
[+] Mohon tidak meninggalkan live link
[+] Terima kasih untuk komentar anda

https://infoalya.com

  1. <a href="http://www.misurabaya.org/2017/09/belajar-vba-yuukk.html">Belajar VBA Yuukk - OP MI KOTA SURABAYA</a>

    ReplyDelete
  2. <script type='text/javascript'>
    //<![CDATA[
    $('#comments p, #comments dd').each(function() {
    $('b[rel^="h"]', this).nextAll().filter('br').remove();
    $('i[rel="pre"]', this).replaceWith(function() {
    return $('<pre></pre>').append($(this).contents());
    });
    $('i[rel="image"]', this).replaceWith(function() {
    return $('<img />').attr('src', $(this).text());
    });
    // Menyisipkan tag `<h3>`
    $('b[rel="h3"]', this).replaceWith(function() {
    return $('<h3></h3>').append($(this).contents());
    });
    $('b[rel="quote"]', this).replaceWith(function() {
    return $('<blockquote></blockquote>').append($(this).contents());
    });
    $('i[rel="code"]', this).contents().unwrap().wrap('<code></code>');
    });
    //]]>
    </script>

    ReplyDelete
Post a Comment
Previous Post Next Post