jquery adding attribute in the element tr, td and div -


sir, need use jquery add element in tag td, tr , div contains onmouseout , onmouseover.

if found onmouseout="any function" need add attribute onblur="same function onmouseout".

then if found onmouseover="any function" need add attribute onfocus="sane functions onmouseover".

this functions contains in tag td, tr or div.

example td:

<td onmouseover="menu_hoverstatic(this)" onmouseout="menu_unhover(this)" onkeyup="menu_key(this)" id="zz1_gs"> 

then need:

<td onmouseover="menu_a(this)" onfocus="menu_a(this)" onmouseout="menu_unhvr(this)" onblur="menu_unhvr(this)" onkeyup="menu_key(this)" id="zz1_gs"> 

example tr:

<tr onmouseover="menu_hoverdynamic(this)" onmouseout="menu_unhover(this)" onkeyup="menu_key(this)" id="zz86756f"> 

then need this:

<tr onmouseover="mdynamic(this)" onfocus="mdynamic(this)" onmouseout="menu_r(this)" onblur="menu_r(this)" onkeyup="menu_ky(this)" id="zz86756f"> 

example div:

<div class="1_5656" id="d867444f" onmouseover="popoup(this)" onmouseout="popostop(this)" style="text-align:center;"> 

then need this:

<div class="1_5656" id="d867444f" onmouseover="popoup(this)" onfocus="popoup(this)" onmouseout="popostop(this)" onblur="popostop(this)" style="text-align:center;"> 

the id name not same , level of td , tr not uniform.

can me achive this?

i have done code not working:

            $('div[onmouseout]').each(function() {         $(this).attr('onblur', $(this).attr('onmouseout'));         }          $('div[onmouseover]').each(function() {         $(this).attr('onfocus', $(this).attr('onmouseover'));         }          $('tr[onmouseout]').each(function() {         $(this).attr('onblur', $(this).attr('onmouseout'));         }          $('tr[onmouseover]').each(function() {         $(this).attr('onfocus', $(this).attr('onmouseover'));         }          $('td[onmouseout]').each(function() {         $(this).attr('onblur', $(this).attr('onmouseout'));         }          $('td[onmouseover]').each(function() {         $(this).attr('onfocus', $(this).attr('onmouseover'));         } 

it's possible copying attributes, , using empty attribute selector grab elements particular attribute:

var $mo = $('[onmouseover]'),     fstr = $mo.attr('onmouseover'),     bstr = $mo.attr('onmouseout'); $mo.attr('onfocus',fstr).attr('onblur',bstr); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -