Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How can I extract all the <span id=hidden>E</span> with id=hidden

    I spend so much time on this today but to no avail. Any help will be greatly appreciated. I'm trying to extract the message 'Elegantly U'. Do node i had to take some of the spans out to fit it in here.
    Code:
    <!doctype html>
    <html>
     <head>
      <title>JavaScript</title>
      <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js">
    /script>
      <script>
       $(function() {
           // Answer goes here.
    	   
       });
       
      </script>
    		<style>
    			body {
    				font-family: monospace;
    			}
    		</style>
    	</head>
    	<body>
        
        
        
        <span id=hidden>E</span><span>6</span><span>u</span><span>l</span><span>^</span><span>6</span><span>f</span><span>N</span><span>{</span><span>y</span><span>w</span><span>9</span><span>)</span><span>Z</span><span>a</span><span>d</span><span>g</span><span>k</span><span>K</span><span>4</span><span>u</span><span>Y</span><span>e</span><span>N</span><span>6</span><span>p</span><span>l</span><span>q</span><span>{</span><span>3</span><span>3</span><span>S</span><span>d</span><span>4</span><span>B</span><span>%</span><span>{</span><span>D</span><span>I</span><span>A</span><span>:</span><span>2</span><span>h</span><span>e</span><span>&</span><span>y</span><span>7</span><span>n</span><span>o</span><span>u</span><span>L</span><span>m</span><span>^</span><span>*</span><span>4</span><span>^</span><span>Z</span><span>p</span><span>k</span><span>1</span><span>9</span><span>e</span><span>h</span><span id=hidden>l</span><span>^</span><span>d</span><span>T</span><span>l</span><span>f</span><span>u</span><span>v</span><span>K</span><span>1</span><span>P</span><span>X</span><span>#</span><span>V</span><span>4</span><span>l</span><span>c</span><span>g</span><span>%</span><span>Z</span><span>K</span><span>4</span><span>z</span><span>5</span><span>t</span><span id=hidden>e</span><span>9</span><span>m</span><span>I</span><span>C</span><span>Q</span><span>o</span><span>y</span><span>*</span><span>e</span><span>x</span><span>s</span><span>M</span><span>0</span><span>J</span><br /><span>A</span><span>0</span><span>8</span><span>:</span><span>X</span><span>O</span><span>#</span><span>4</span><span>%</span><span>q</span><span>R</span><span>M</span><span>B</span><span>e</span><span>Z</span><span>y</span><span>H</span><span>2</span><span>s</span><span>D</span><span>o</span><span>e</span><span>w</span><span>M</span><span>D</span><span>7</span><span>e</span><span>T</span><span>Y</span><span>@</span><span>(</span><span>D</span><span>5</span><span>1</span><span>q</span><span>P</span><span>P</span><span>n</span><span>^</span><span>s</span><span>7</span><span>1</span><span>6</span><span>0</span><span>d</span><span>5</span><span>?</span><span>7</span><span>)</span><span>R</span><span>g</span><span>P</span><span>5</span><span>l</span><span>3</span><span>2</span><span>z</span><span>g</span><span>B</span><span>i</span><span>B</span><span>T</span><span>q</span><span>4</span><span>r</span><span>y</span><span>a</span><span id=hidden>g</span><span>&</span><span>n</span><span>1</span><span>n</span><span>@</span><span>l</span><span>G</span><span>N</span><span>?</span><span>l</span><span>Q</span><span>G</span><span>s</span><span>K</span><span>4</span><span>F</span><span>l</span><span>M</span><span>F</span><span>p</span><span>7</span><span>X</span><span>q</span><span>o</span><span>:</span><span>l</span><span>v</span><span>V</span><span>N</span><span>b</span><span>p</span><span>t</span><span>^</span><br /><span>(</span><span>A</span><span>K</span><span>n</span><span>s</span><span>$</span><span>P</span><span>n</span><span>1</span><span>X</span><span>3</span><span>L</span><span>1</span><span id=hidden>a</span><span>r</span><span>$</span><span>f</span><span>s</span><span>a</span><span>P</span><span>8</span><span>H</span><span>D</span><span>3</span><span>%</span><span>a</span><span>B</span><span>a</span><span>0</span><span>4</span><span>z</span><span>(</span><span>W</span><span>I</span><span>t</span><span>%</span><span>P</span><span>3</span><span>$</span><span>}</span><span>b</span><span>A</span><span>p</span><span>r</span><span>j</span><span>m</span><span>B</span><span>M</span><span>P</span><span>f</span><span>t</span><span id=hidden>n</span><span>e</span><span>I</span><span>%</span><span>4</span><span>X</span><span>z</span><span>p</span><span>)</span><span>I</span><span>v</span><span>^</span><span>g</span><span>(</span><span>6</span><span>G</span><span>T</span><span>s</span><span>j</span><span>k</span><span>R</span><span>X</span><span>?</span><span>h</span><span>Q</span><span>}</span><span>v</span><span>?</span><span>3</span><span>T</span><span>k</span><span>#</span><span>z</span><span>:</span><span>x</span><span>0</span><span>R</span><span>1</span><span>x</span><span>R</span><span id=hidden>t</span><span>r</span><span>j</span><span>!</span><span>Y</span><span>3</span><span>h</span><span>{</span><span>S</span><span>r</span><span>U</span><span>k</span><br /><span>r</span><span>C</span><span>X</span><span>%</span><span>u</span><span>@</span><span>n</span><span>?</span><span>Z</span><span>C</span><span>N</span><span>E</span><span>7</span><span>k</span><span>Y</span><span>^</span><span>6</span><span>8</span><span>6</span><span>7</span><span>u</span><span>$</span><span>c</span><span>@</span><span>9</span><span>z</span><span>y</span><span>B</span><span>G</span><span>h</span><span>{</span><span>1</span><span>a</span><span>d</span><span>*</span><span>t</span><span>g</span><span>H</span><span>k</span><span>Q</span><span>9</span><span>U</span><span>b</span><span>Z</span><span>v</span><span>f</span><span>)</span><span>I</span><span>s</span><span>S</span><span id=hidden>l</span><span>9</span><span>}</span><span>:</span><span>0</span><span>r</span><span>Y</span><span>g</span><span>r</span><span>%</span><span>t</span><span>p</span><span>W</span><span>H</span><span>t</span><span>(</span><span>K</span><span>F</span><span>E</span><span>#</span><span>9</span><span>b</span><span>t</span><span>Q</span><span>%</span><span>F</span><span>W</span><span>p</span><span>c</span><span>k</span><span>^</span><span>M</span><span>r</span><span>z</span><span>c</span><span>B</span><span>H</span><span>i</span><span>U</span><span>J</span><span>d</span><span>$</span><span>k</span><span>D</span><span>j</span><span id=hidden>y</span><span>}</span><span>Z</span><span>E</span><span>x</span><span>i</span><span>i</span><br /><span>c</span><span>D</span><span>0</span><span>n</span><span>Q</span><span>K</span><span>J</span><span>E</span><span>!</span><span>1</span><span>R</span><span>7</span><span>F</span><span>B</span><span>v</span><span>Y</span><span>E</span><span>u</span><span>R</span><span>u</span><span>Y</span><span>g</span><span>3</span><span>S</span><span>7</span><span>k</span><span>(</span><span>j</span><span id=hidden> </span><span>p</span><span>}</span><span>y</span><span>t</span><span>S</span><span>w</span><span>L</span><span>H</span><span>X</span><span>y</span><span>6</span><span>b</span><span>w</span><span>p</span><span>b</span><span>8</span><span>:</span><span>d</span><span>t</span><span>V</span><span>!</span><span>W</span><span>j</span><span>M</span><span>3</span><span>S</span><span>a</span><span>o</span><span>o</span><span>R</span><span>s</span><span>G</span><span>$</span><span id=hidden>u</span><span>8</span><span>m</span><span>7</span><span>b</span><span>0</span><span>0</span><span>w</span><span>r</span><span>5</span><span>G</span><span>i</span><span>n</span><span>R</span><span>R</span><span>Y</span><span>g</span><span>0</span><span>W</span><span>9</span><span>a</span><span>3</span><span>b</span><span>&</span><span>Q</span><span>8</span><span>I</span><span>}</span><span>3</span><span>$</span><span>4</span><span>5</span><span>y</span><span>)</span><span>4</span><span>o</span><span>x</span><span>r</span><span>u</span><span>1</span><br /><span>V</span><span>s</span><span>P</span><span>(</span><span>d</span><span>A</span><span>G</span><span>g</span><span>0</span><span>$</span><span>S</span><span>f</span><span>k</span><span>#</span><span>*</span><span>o</span><span>^</span><span>5</span><span>4</span><span>5</span><span>r</span><span>C</span><span>N</span><span>t</span><span>*</span><span id=hidden>n</span><span>c</span><span>U</span><span>Q</span><span>(</span><span>Z</span><span>u</span><span>N</span><span>o</span><span>r</span><span>#</span><span>O</span><span>1</span><span>e</span><span>R</span><span>s</span><span>G</span><span>m</span><span>^</span><span>b</span><span>z</span><span>:</span><span>U</span><span>a</span><span>4</span><span>C</span><span>$</span><span id=hidden>s</span><span>w</span><span>:</span><span>2</span><span>#</span><span>:</span><span>U</span><span>1</span><span>B</span><span>7</span><span>a</span><span>d</span><span>U</span><span>a</span><span>t</span><span>d</span><span>U</span><span>D</span><span>B</span><span>L</span><span>b</span><span>V</span><span>J</span><span>G</span><span>N</span><span>C</span><span>e</span><span>D</span><span>J</span><span>Y</span><span>(</span><span>B</span><span>Z</span><span>*</span><span>s</span><span>P</span><span>(</span><span>H</span><span>F</span><span>%</span><span id=hidden>c</span><span>L</span><span>t</span><span>^</span><span>#</span><span>x</span><span>&</span><span>l</span><span>m</span><span>Q</span><span>5</span><br /><span>v</span><span>!</span><span>2</span><span>k</span><span>x</span><span>C</span><span>G</span><span>4</span><span>T</span><span>j</span><span>r</span><span>R</span><span>X</span><span>6</span><span>1</span><span>N</span><span>5</span><span>z</span><span>&</span><span>o</span><span>q</span><span>:</span><span>u</span><span>k</span><span>@</span><span>t</span><span>M</span><span>R</span><span>e</span><span>6</span><span>z</span><span>r</span><span>V</span><span>j</span><span>X</span><span>I</span><span>8</span><span id=hidden>r</span><span>A</span><span>M</span><span>D</span><span>3</span><span>k</span><span>)</span><span>x</span><span>A</span><span>$</span><span>^</span><span>M</span><span>u</span><span>y</span><span>E</span><span>4</span><span>Z</span><span>3</span><span>i</span><span>K</span><span>j</span><span>c</span><span>j</span><span>Y</span><span>)</span><span>z</span><span>A</span><span>*</span><span>m</span><span>b</span><span>@</span><span>S</span><span>o</span><span>h</span><span id=hidden>a</span><span>F</span><span>Q</span><span>K</span><span>t</span><span>J</span><span>J</span><span>$</span><span>*</span><span>u</span><span>n</span><span>y</span><span>1</span><span>Q</span><span>0</span><span>u</span><span>P</span><span>I</span><span>L</span><span>U</span><span>g</span><span>r</span><span>c</span><span>6</span><span>G</span><span>s</span><span>n</span><span>B</span><span>:</span><span>k</span><span>C</span><br /><span>(</span><span>d</span><span>6</span><span>J</span><span>1</span><span>L</span><span>1</span><span>j</span><span>&</span><span>C</span><span>r</span><span>z</span><span>}</span><span>G</span><span>i</span><span>#</span><span>e</span><span>x</span><span>B</span><span>K</span><span>j</span><span>l</span><span>}</span><span>?</span><span>#</span><span>M</span><span>:</span><span>:</span><span>6</span><span>s</span><span>a</span><span>}</span><span>P</span><span>q</span><span>q</span><span>7</span><span id=hidden>m</span><span>F</span><span>e</span><span>}</span><span>P</span><span>%</span><span>i</span><span>Y</span><span>k</span><span>)</span><span>{</span><span>k</span><span>x</span><span>T</span><span>y</span><span>@</span><span>^</span><span>{</span><span>1</span><span>%</span><span>Q</span><span>y</span><span>X</span><span>y</span><span>u</span><span>V</span><span>W</span><span>1</span><span>M</span><span>$</span><span>S</span><span>o</span><span>f</span><span>&</span><span>g</span><span>3</span><span>)</span><span>H</span><span id=hidden>b</span><span>k</span><span>q</span><span>#</span><span>7</span><span>x</span><span>n</span><span>f</span><span>F</span><span>F</span><span>C</span><span>J</span><span>z</span><span>w</span><span>o</span><span>m</span><span>)</span><span>k</span><span>9</span><span>6</span><span>h</span><span>$</span><span>l</span><span>}</span><span>5</span><span>Z</span><span>k</span><span>)</span><br /><span>l</span><span>I</span><span>A</span><span>8</span><span>&</span><span>!</span><span>o</span><span id=hidden>l</span><span>f</span><span>I</span><span>f</span><span>N</span><span>c</span><span>r</span><span>h</span><span>$</span><span>i</span><span>!</span><span>O</span><span>V</span><span>f</span><span>%</span><span>p</span><span>G</span><span>p</span><span>a</span><span>C</span><span>9</span><span>u</span><span>B</span><span>W</span><span>7</span><span>(</span><span>e</span><span>Y</span><span>?</span><span>F</span><span>:</span><span>Y</span><span>O</span><span>x</span><span id=hidden>e</span><span>B</span><span>w</span><span>J</span><span>J</span><span>Q</span><span>h</span><span>S</span><span>$</span><span>E</span><span>Q</span><span>}</span><span>?</span><span>Y</span><span>t</span><span>H</span><span>Z</span><span>C</span><span>7</span><span>s</span><span>q</span><span>p</span><span>H</span><span>5</span><span>h</span><span id=hidden> </span><span>t</span><span>h</span><span>g</span><span>V</span><span>U</span><span>y</span><span>f</span><span>T</span><span>L</span><span>g</span><span>3</span><span>}</span><span>$</span><span>R</span><span>Q</span><span>0</span><span>:</span><span>x</span><span>K</span><span>#</span><span>j</span><span>F</span><span>o</span><span>S</span><span>V</span><span>T</span><span>U</span><span>{</span><span>W</span><span>w</span><span>r</span><span>*</span><span>d</span><span>E</span><span>c</span><span>t</span></body>
    </html>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,050
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Use class not id as id should be unique in a document. Then try this:

    Code:
    var text = $('.hidden').map(function() {
       return $(this).text();
    }).get().join('');
    alert(text);

  • Users who have thanked glenngv for this post:

    chritopher (11-12-2013)

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,350
    Thanks
    11
    Thanked 589 Times in 570 Posts
    Code:
    jQuery("[id='hidden']").text()
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • Users who have thanked rnd me for this post:

    chritopher (11-12-2013)

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Move the JavaScript to the bottom just before the </body> tag so it doesn't slow down the loading of the page.

    You can then also do away with the JavaScript code that waits for the entire page to load and run your JavaScript sooner.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    chritopher (11-12-2013)

  • #5
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thank you very much. The id to class thing was the problem. During my version I was only getting one span tag and it was because the id is unique. I never saw that error. Thanks again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •