PHPHtmlParser\Dom::getElementById PHP 메소드

getElementById() 공개 메소드

Simple wrapper function that returns an element by the id.
public getElementById ( string $id ) : AbstractNode
$id string
리턴 PHPHtmlParser\Dom\AbstractNode
    public function getElementById($id)
    {
        $this->isLoaded();
        return $this->find('#' . $id, 0);
    }

Usage Example

예제 #1
0
 public function testConfigStrict()
 {
     $dom = new Dom();
     $dom->setOptions(['strict' => true]);
     $dom->load('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div>');
     $this->assertEquals(' ', $dom->getElementById('hey')->nextSibling()->text);
 }
All Usage Examples Of PHPHtmlParser\Dom::getElementById