Delete everything inside a tag but another tag jquery

I have this piece of html

    <div id="Cart">
    <p>
        You have <strong>1</strong> item in your cart.
        Your sub total is <strong>$35.00</strong>.
    </p>
    </div>

I need to be able to get the information between the <strongs> and delete everything else, is that possible with jquery? I tried $("#Cart strong:not()") But didn't select anything, I thought maybe placing the info in a variable, deleting everything with .remove and reprinting the variables but I don't really know how to do that, can someone help me?.

The information between the strong is dynamic, I believe all the other is in a php file that I dont have access to... maybe filtering the words and removing them? Any advice will be welcome :)

Answers


Here's some code to get you started:

var strongs = [];
$('#Cart strong').each(function() {
    strongs.push($(this).text());
});
$('#Cart').html('First strong contains: ' + strongs[0] + '; And the second: ' + strongs[1]);

Here's an example of it working: http://jsfiddle.net/SBRhk/


Need Your Help

GWT Timer lifecycle

java gwt timer

Let's say I have the following (ref page):

How to install grails project

grails build-process

I've created new grails plugin with this quick start reference.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.