Solved

Extract message using Jquery

Posted on 2013-01-19
4
230 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
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for 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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now