显示隐藏的span元素Javascript

时间:2015-05-30 00:35:08

标签: javascript jquery html css

我有以下代码:

open

我想透露隐藏的所有<body><span hidden>E</span><span>U</span><span>$</span><span>U</span><span>W</span><span>X</span><span>F</span><span>1</span><span>6</span><span>X</span><span>a</span><span>Y</span><span>)</span><span>a</span><span>l</span><span>1</span><span>D</span><span>(</span><span>M</span><span>J</span><span>K</span><span>%</span><span>y</span><span>X</span><span>x</span><span>f</span><span>y</span><span>W</span><span>:</span><span>}</span><span>N</span><span>k</span><span>z</span><span>E</span><span>o</span><span>k</span><span>2</span><span>N</span><span>)</span><span>R</span><span>$</span><span>d</span><span>Z</span><span>F</span><span>j</span><span hidden>l</span><span>J</span><span>A</span><span>#</span><span>6</span><span>9</span><span>n</span><span>(</span><span>!</span><span>I</span><span>u</span><span>:</span><span>b</span><span>R</span><span>n</span><span>k</span><span>$</span><span>*</span><span>c</span><span>8</span><span>s</span><span>?</span><span>?</span><span>8</span><span>:</span><span>$</span><span>I</span><span>I</span><span>1</span><span>B</span><span>3</span><span>f</span><span>O</span><span>V</span><span>(</span><span>n</span><span>y</span><span>3</span><span>f</span><span>d</span><span>i</span><span>D</span><span>Y</span><span>2</span><span>S</span><span hidden>e</span><span>k</span><span>W</span><span>g</span><span>z</span><span>C</span><span>c</span><span>o</span><span>r</span><span>$</span><span>X</span><span>o</span><span>T</span><br /><span>B</span><span>#</span><span>c</span><span>N</span><span>O</span><span>%</span><span>n</span><span>Q</span><span>J</span><span>9</span><span>Q</span><span>E</span><span>Y</span><span>4</span><span>B</span><span>5</span><span>L</span><span>E</span><span>o</span><span>B</span><span>S</span><span>r</span><span>p</span><span>@</span><span>&</span><span>e</span><span>M</span><span>G</span><span>O</span><span>j</span><span>&</span><span>h</span><span>L</span><span>O</span><span>i</span><span>N</span><span>f</span><span>%</span><span>O</span><span>x</span><span>y</span><span>O</span><span>H</span><span>m</span><span>X</span><span>C</span><span>3</span><span>V</span><span>^</span><span>z</span><span>7</span><span>5</span><span>{</span><span>$</span><span>e</span><span>y</span><span>Y</span><span>n</span><span hidden>g</span><span>H</span><span>@</span><span>M</span><span>A</span><span>t</span><span>l</span><span>o</span><span>m</span><span>n</span><span>n</span><span>B</span><span hidden>a</span> 元素,并隐藏所有其他没有隐藏属性的span元素。我怎么能用JavaScript / jQuery实现呢?

更新 感谢回答的问题,我可以用span揭示隐藏的元素 这是新的输出:

$('span').toggle();

我希望将其格式化为El egan tly un sc ram ble t his me ss ag e us ing t he s pac e p rov i ded . Th en wr it e th e s cram b le r tha t m ade it. Th e ans we r is a n o bj ec t w it h glob al sc op e t h at c an scra m ble and un sc r amb le any t ex t a ny num ber of ti mes . 标记,例如。我怎样才能做到这一点?

2 个答案:

答案 0 :(得分:3)

使用jQuery非常简单:

$('span').toggle();

并删除换行符:

$('br').remove();

答案 1 :(得分:0)

这可能就是你要找的东西:

$('span').wrapAll('<p>');

更多信息:http://api.jquery.com/wrapall/