Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript删除html节标记_Javascript_Jquery_Html - Fatal编程技术网

使用javascript删除html节标记

使用javascript删除html节标记,javascript,jquery,html,Javascript,Jquery,Html,我有一个HTML页面,它有两个部分标记,但我只想删除以以下内容开头的部分: <section class="news-rsf-abstract"></section> 以下是整个HTML页面: <div id="chunk_content"> <div class="newsHeadingData"> <div class="row"> Oct 28 2015 07:59:12 </div> </div>

我有一个HTML页面,它有两个部分标记,但我只想删除以以下内容开头的部分:

<section class="news-rsf-abstract"></section>
以下是整个HTML页面:

<div id="chunk_content">
<div class="newsHeadingData">
<div class="row">
Oct 28 2015 07:59:12
</div>
</div>



<newsstory>

    <meta charset="UTF-8">
    <meta content="application/xhtml+xml" property="Content-Type">
    <title>News Story</title>

  <section class="news-rsf-abstract"><ul>
<li>Drugstore deal valued at $17.2 billion including debt</li>
<li>Walgreens adjusted earnings of 88 cents top 81-cent estimate</li>
</ul></section><section class="news-header"><p class="news-byline" itemprop="Byline"><meta content="http://bloomberg.com/StoryFormat/NewsIndividualAttribution" itemprop="BylineType">By <span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="4538381" itemprop="uuid">
<meta content="2491003" itemprop="pepl">
<meta content="by" itemprop="role">
<meta content="reporter" itemprop="role">
<meta content="Crayton Harrison" itemprop="name">Crayton Harrison</span></p>
<span class="news-dateline" itemprop="NewsDateline" itemscope="itemscope"><meta content="New York" itemprop="location">
<meta content="Bloomberg" itemprop="publisher">(Bloomberg) --</span></section><section class="news-rsf-news-body"><p><a hover="Company Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="company" target="_blank" ticker="WBA%20US%20EQUITY " title="Company Profile" class="hoverDocumentLink" id="company_WBA%20US%20EQUITY "><meta content="idm403148084" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="bbg://securities/WBA%20US%20Equity" itemprop="url">
<meta content="SecurityLink" itemprop="type">
<meta content="WBA US Equity" itemprop="security">Walgreens Boots Alliance Inc.</a> agreed to acquire Rite Aid Corp. for about $9.4 billion in cash in a transaction to further expand the company's role in the distribution of medications in the U.S.</p>
<p>The Rite Aid transaction, announced Tuesday, would <a hover="See Related Story" href="/document/NWWCLO6K50Y0" itemprop="StoryLink" itemscope="itemscope" link-type="news-stories" news-stories="NWWCLO6K50Y0" target="_blank" title="Walgreens Acquisition of Rite Aid Would Likely Bring FTC Review"><meta content="idm402947380" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="StoryLink" itemprop="type">
<meta content="NWWCLO6K50Y0" itemprop="suid">combine</a> the second- and third-largest drugstore chains in the U.S., with a total of about 12,800 locations, helping Walgreens vault past market leader CVS Health Corp. The acquisition will add to Walgreens' earnings beginning a full year after completion and will produce more than $1 billion in savings from cost overlaps, the companies said Tuesday in a <a hover="See Related Story" href="/document/NWWDP0MEQTXF" itemprop="StoryLink" itemscope="itemscope" link-type="news-stories" news-stories="NWWDP0MEQTXF" target="_blank" title="Walgreens Boots Alliance to Acquire Rite Aid for $17.2 Billion in All-Cash Transaction"><meta content="idm402992828" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="StoryLink" itemprop="type">
<meta content="NWWDP0MEQTXF" itemprop="suid">statement</a>. Including debt, the deal is valued at $17.2 billion, they said.</p>
<p>The company also reported fiscal fourth-quarter earnings showed how it reaps cost savings from mergers. Walgreens said it has saved $799 million in fiscal 2015 after combining with Alliance Boots GmbH last year.</p>
<p><a hover="Company Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="company" target="_blank" ticker="RAD%20US%20EQUITY " title="Company Profile" class="hoverDocumentLink" id="company_RAD%20US%20EQUITY "><meta content="idm402989828" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="bbg://securities/RAD%20US%20Equity" itemprop="url">
<meta content="SecurityLink" itemprop="type">
<meta content="RAD US Equity" itemprop="security">Rite Aid</a> shares fell 8.2 percent to $7.96 in early trading Wednesday, below Walgreens' offer of $9 a share, reflecting speculation that the transaction will face antitrust scrutiny. They had risen as high as $8.74 earlier after the Wall Street Journal reported the companies were close to a deal. Walgreens shares rose 1.4 percent to $96.50.</p>
<h3>Deal Opportunity</h3>
<p>Rite Aid's stock had slumped 29 percent since Sept. 16, after the company lowered profit and revenue forecasts for the year, giving Walgreens a potential opportunity to make an offer. The price represents a 48 percent premium to Rite Aid's closing price on Monday.</p>
<p>Speculation that Walgreens would pursue Rite Aid rose to a crescendo in March after <span bbg-href="bbg://screens/RICH" itemprop="StoryLink" itemscope="itemscope" title="Bloomberg Billionaires Index">billionaire<meta content="idm402968796" itemprop="ident">
<meta content="bbg://screens/RICH" itemprop="url">
<meta content="RICH" itemprop="function"></span> <span bbg-href="bbg://screens/BBIO%201719695" itemprop="StoryLink" itemscope="itemscope" title="Billionaire Profile">Stefano Pessina<meta content="NWXMJQSYF023" itemprop="ident">
<meta content="bbg://screens/BBIO%201719695" itemprop="url">
<meta content="BBIO 1719695" itemprop="function"></span>, who took over in January as interim chief executive officer at Walgreens after it acquired Alliance Boots, said he envisioned doing his next big deal in the U.S.</p>
<h3>Pharmacy Benefits</h3>
<p>In addition to expanding its drugstore locations, the Rite Aid deal gives Walgreens its first foray into the business of managing drug benefits for insurers and employers, an area where rival CVS is a leader. Rite Aid entered that business by acquiring Envision Pharmaceutical Services Inc. for about $2 billion this year.</p>
<p>If Walgreens aims to get bigger in drug-benefit management, it could use EnvisionRX to acquire other small competitors to build that business, said <a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="7366934" title="Person Profile" class="hoverDocumentLink" id="person_7366934"><meta content="idm402962036" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="bbg://people/profile/7366934" itemprop="url">
<meta content="ProfileLink" itemprop="type">
<meta content="7366934" itemprop="profile">Ross Muken</a>, an analyst at Evercore ISI who advises holding the shares.</p>
<p>Rite Aid CEO <a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="1983565" title="Person Profile" class="hoverDocumentLink" id="person_1983565"><meta content="idm403145404" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="bbg://people/profile/1983565" itemprop="url">
<meta content="ProfileLink" itemprop="type">
<meta content="1983565" itemprop="profile">John Standley</a> is eligible to receive $23.4 million if he's terminated after the deal, according to data compiled by Bloomberg based on Walgreens' offer price per share.</p>
<p>Shares of drug distributor McKesson Corp. dropped 4.2 percent, while AmerisourceBergen Corp., Walgreens' distribution partner for medications, jumped 4.2 percent. Rite Aid represents about $18 billion of McKesson's revenue, according to Evercore ISI.</p>
<p>On Wednesday, Walgreens <a hover="See Related Story" href="/document/NWXGN36K50XY" itemprop="StoryLink" itemscope="itemscope" link-type="news-stories" news-stories="NWXGN36K50XY" target="_blank" title="Walgreens Posts Profit That Tops Estimates as Sales Increase"><meta content="idm403141484" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="StoryLink" itemprop="type">
<meta content="NWXGN36K50XY" itemprop="suid">reported fiscal fourth-quarter earnings</a> that beat analysts' estimates. Excluding one-time items, earnings were 88 cents a share, beating the 81-cent average of analysts' estimates compiled by Bloomberg. Walgreens' pharmacies filled 222 million prescriptions in the quarter, up 4.6 percent from a year before.</p>
<h3>CVS's Moves</h3>
<p>While Pessina had made clear his appetite for deals, he had been cagey about what kind of acquisition he might pursue. He has said only that the company wanted to participate in what he saw as the inevitable consolidation of the long distribution chain that delivers drugs from manufacturers to patients in the U.S.</p>
<p>While Pessina prowled for a deal, CVS stayed busy. In May, Walgreens' top rival agreed to purchase nursing-home pharmacy Omnicare Inc. for $12.7 billion, expanding services to the country's elderly. Less than four weeks later, CVS struck a deal to acquire Target Corp.'s pharmacies and clinics for $1.9 billion, putting its brand, which includes OneMinute Clinics, in retail locations across 47 states.</p>
<p>"Their biggest competitor in the U.S. has been getting bigger," said <a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="16849787" title="Person Profile" class="hoverDocumentLink" id="person_16849787"><meta content="idm403136676" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="bbg://people/profile/16849787" itemprop="url">
<meta content="ProfileLink" itemprop="type">
<meta content="16849787" itemprop="profile">Jonathan Palmer</a>, an analyst at Bloomberg Intelligence.</p>
<p>Walgreens already has a foothold in the drug-distribution business after it signed a 10-year agreement with AmerisourceBergen in 2013 and became the company's third-largest shareholder.</p>
<p>Today's Walgreens was built by acquisition. Pessina developed Bern, Switzerland-based Alliance Boots into a powerhouse through more than three decades of mergers before selling it to Walgreen Co. last year. He's now the company's largest shareholder with a 13 percent stake.</p>
<p>Walgreens will revamp Rite Aid's stores to focus on health, wellness and beauty, just as it has been remaking its own stores since the Alliance Boots deal, the company said. Rite Aid will continue to operate under its own brand at first, though eventually the plan is to integrate the two chains.</p>
<p>The acquirer plans to finance the deal with cash and new debt, it said. UBS AG was Walgreens' financial adviser, with Simpson Thacher &amp; Bartlett LP and Weil, Gotshal &amp; Manges LLP providing legal advice. Citigroup Inc. gave financial advice to Rite Aid, with legal counsel from Skadden, Arps, Slate, Meagher &amp; Flom LLP and Jones Day.</p></section><section class="news-footer"><p>--With assistance from <span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<meta content="bbg://people/profile/18991472" itemprop="url">
<meta content="amelin3@bloomberg.net" itemprop="email">
<meta content="+1-212-617-3047" itemprop="telephone">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="13216940" itemprop="uuid">
<meta content="18991472" itemprop="pepl">
<meta content="assist" itemprop="role">
<meta content="Anders Melin" itemprop="name">
<a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="18991472" title="Person Profile" class="hoverDocumentLink" id="person_18991472"><meta content="NWXIME6K50Y6" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="ProfileLink" itemprop="type">
<meta content="bbg://people/profile/18991472" itemprop="url">
<meta content="18991472" itemprop="profile">Anders Melin</a></span> and <span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<meta content="bbg://people/profile/19366612" itemprop="url">
<meta content="mmittelman@bloomberg.net" itemprop="email">
<meta content="+1-212-617-1369" itemprop="telephone">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="14874620" itemprop="uuid">
<meta content="19366612" itemprop="pepl">
<meta content="assist" itemprop="role">
<meta content="Melissa Mittelman" itemprop="name">
<a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="19366612" title="Person Profile" class="hoverDocumentLink" id="person_19366612"><meta content="NWXIME6K50Y7" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="ProfileLink" itemprop="type">
<meta content="bbg://people/profile/19366612" itemprop="url">
<meta content="19366612" itemprop="profile">Melissa Mittelman</a></span> in New York. <br><br>To contact the reporter on this story:<br><span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<meta content="bbg://people/profile/2491003" itemprop="url">
<meta content="tharrison5@bloomberg.net" itemprop="email">
<meta content="+1-212-617-6145" itemprop="telephone">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="4538381" itemprop="uuid">
<meta content="2491003" itemprop="pepl">
<meta content="by" itemprop="role">
<meta content="reporter" itemprop="role">
<meta content="Crayton Harrison" itemprop="name">
<a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="2491003" title="Person Profile" class="hoverDocumentLink" id="person_2491003"><meta content="NWXIME6K50Y8" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="ProfileLink" itemprop="type">
<meta content="bbg://people/profile/2491003" itemprop="url">
<meta content="2491003" itemprop="profile">Crayton Harrison</a></span> in New York at +1-212-617-6145 or<br><a hover="Web Link" href="mailto:tharrison5@bloomberg.net" target="_blank">tharrison5@bloomberg.net</a><br>To contact the editors responsible for this story:<br><span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<meta content="bbg://people/profile/2491003" itemprop="url">
<meta content="tharrison5@bloomberg.net" itemprop="email">
<meta content="+1-212-617-6145" itemprop="telephone">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="4538381" itemprop="uuid">
<meta content="2491003" itemprop="pepl">
<meta content="editor" itemprop="role">
<meta content="responsible" itemprop="role">
<meta content="Crayton Harrison" itemprop="name">
<a hover="Person Profile" href="javascript:void(0);" itemprop="StoryLink" itemscope="itemscope" link-type="person" person="2491003" title="Person Profile" class="hoverDocumentLink" id="person_2491003"><meta content="NWXIME6K50Y9" itemprop="ident">
<meta content="true" itemprop="active">
<meta content="ProfileLink" itemprop="type">
<meta content="bbg://people/profile/2491003" itemprop="url">
<meta content="2491003" itemprop="profile">Crayton Harrison</a></span> at +1-212-617-6145 or<br><a hover="Web Link" href="mailto:tharrison5@bloomberg.net" target="_blank">tharrison5@bloomberg.net</a><br><span class="news-rsf-editor-byline"><span itemscope="itemscope" itemtype="http://schema.org/Person"><link href="http://bloomberg.com/StoryFormat/ContactInfo" itemprop="additionalType">
<meta content="bbg://people/profile/16650820" itemprop="url">
<meta content="darmstrong17@bloomberg.net" itemprop="email">
<meta content="+1-212-617-8933" itemprop="telephone">
<span itemprop="workLocation" itemscope="itemscope" itemtype="http://schema.org/Place"><meta content="New York" itemprop="name"></span><meta content="6891420" itemprop="uuid">
<meta content="16650820" itemprop="pepl">
<meta content="editor" itemprop="role">
<meta content="primary" itemprop="role">
<meta content="Drew Armstrong" itemprop="name">Drew Armstrong</span></span></p></section>
</newsstory><div class="rsf-scripts"><script type="text/javascript">function onYouTubePlayerAPIReady() {}</script></div>



</div>

如何在JavaScript中仅去掉以开头的部分

如果它是唯一一个具有该类名的类名,这将起作用:

<section class="x123"></section>
<section class="x456"></section>
<section class="y789"></section>
$("section[class='news-rsf-abstract']").remove();
$('#chunk_content').find('section').first().remove();
如果不是,但它始终是第一个节标记,则这将起作用:

$("section[class='news-rsf-abstract']").remove();
$('#chunk_content').find('section').first().remove();

如果这两个条件都不正确,您将需要额外的条件来确保您的目标是正确的section元素。

@ReazurRahman:嘿,是的,它是这样的:。您还没有将jQuery库包括在小提琴中!!他没有把jquery库包括在他的小提琴里。你们是对的,我忘了包括jquery。它现在很有魅力。Thanks@ReazurRahman:太好了!一定要接受对你帮助最大的答案。祝你好运。@papazzokid^是什么意思,我们为什么要用它。@ReazurRahman你的小提琴中的代码与我发布的代码不同。除此之外,您还需要包括jquery库,否则$将是未定义的。请检查控制台是否有错误。@ReazurRahman很高兴听到这个消息!确保你接受对你帮助最大的答案。此外,你应该投票支持任何对你有帮助的答案。这些措施将帮助未来有类似问题的用户更快地找到最佳答案。