Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Extract message using Jquery

Posted on 2013-01-19
4
Medium Priority
?
247 Views
Last Modified: 2013-01-19
Hello Experts.

I am trying to extract "Save completed successfully" from the html below and place in a  variable using jquery or javascript. I don't know if it matters but notice that the span class id is the same for both spans.


Thanks
Bill

<div class="ui-widget advance-error">
<div class="ui-state-highlight ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
 MESSAGE ONE
</p>
</div>
</div>
<div class="ui-widget advance-error">
<div class="ui-state-highlight ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
Save completed successfully
</p>
</div>
</div>
0
Comment
Question by:bill_home
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 38796416
check this page : http://jsfiddle.net/kJx3d/1/
$("div.ui-widget.advance-error p:last").text();

Open in new window

0
 

Author Comment

by:bill_home
ID: 38796421
Thanks leakim971,

But I can't guarantee that the " save completed" will be the last message.

Also, thanks for the link that is awesome!!

Bill
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38796430
so the question is what can you guarantee? if you've no id, no unique class, no unique reference, you have no way to get your message
0
 

Author Comment

by:bill_home
ID: 38796480
got it thanks!! It is a quagmire. thanks for the help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question