css - How to wrapAll an ELEMENT from title by jQuery? -


now playing pagetranstioncollection

and want wrapall element title="wrap pt-page1". after magic jquery script goes

<div class='pt-page pt-page-2'>  <div title='wrap pt-page-2'> element blahblahblah</div>

so tried modificate classtitleadder:

<script>  $(document).on('ready', function() {  $("[title*='class']").addclass(function(){  return $(this).attr('title');}).removeclass('class').removeattr('title');  });</script>

to:

<script>//Враппит страницу полностью    $("[title*='wrap']").wrapall(  (function(){  $(this).text('"<div class='pt-page');  return $(this).attr('title');  $(this).text('' />"'));}).removeattr('title');</script>

yes, know foolish me, can me? maybe have right solution?

thanks. hope understood question.

some specific example more details:

i have element title="wrap pt-page-1", element title="wrap pt-page-2" , on. script should find elements [title*='wrap'] after wrapall , in future div have class="pt-page pt-page-2 (or pt-page-1)". pt-page-2 must return title (it second word after wrap).

that working script , need.

<script>  $( document ).ready(function() {      $("[title*='wrap']").wrapall(function() {    return "<div class='pt-page " + $(this).attr('title') + "'></div>";  }).removeattr('title')});  </script>

so may know how delete "wrap" class every element?


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -