Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Extract message using Jquery

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
bill_home
Asked:
bill_home
  • 2
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
check this page : http://jsfiddle.net/kJx3d/1/
$("div.ui-widget.advance-error p:last").text();

Open in new window

0
 
bill_homeAuthor Commented:
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
 
leakim971PluritechnicianCommented:
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
 
bill_homeAuthor Commented:
got it thanks!! It is a quagmire. thanks for the help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now