[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • 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

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

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