8000 Can't get button value using the val function · Issue #3951 · cheeriojs/cheerio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Can't get button value using the val function #3951
Open
@ribeirobreno

Description

@ribeirobreno

In the latest version (0.22.0), getting a button value is not possible with the .val() function.

import * as cheerio from "cheerio";

let ch = cheerio.load(`<form><button value="something">I'm a button</button></form>`);
console.log(ch('button').val());
console.log(ch('button').attr('value'));

The code snippet above will return:

undefined
something

To match jQuery behavior, it should return:

something
something

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0