Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

Đây là HTML:

Show
      
    Remember me

    | <-------- **** I want to remove this character****

    Có một cách để loại bỏ nhân vật này "|" Từ HTML ở trên với jQuery hoặc CSS?

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    Animuson ♦

    52.9K28 Huy hiệu vàng140 Huy hiệu bạc146 Huy hiệu đồng28 gold badges140 silver badges146 bronze badges

    Đã hỏi ngày 27 tháng 7 năm 2014 lúc 16:44Jul 27, 2014 at 16:44

    0

    Điều này sẽ hoạt động trong vấn đề này

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    

    Đã trả lời ngày 27 tháng 7 năm 2014 lúc 16:49Jul 27, 2014 at 16:49

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    MritunjaymritunjayMritunjay

    24.7K7 Huy hiệu vàng51 Huy hiệu bạc67 Huy hiệu Đồng7 gold badges51 silver badges67 bronze badges

    4

    THỬ NGHIỆM

    Dùng cái này:

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    

    Đã trả lời ngày 27 tháng 7 năm 2014 lúc 16:53Jul 27, 2014 at 16:53

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    PeterkapeterkaPeterKA

    23,5K5 Huy hiệu vàng24 Huy hiệu bạc48 Huy hiệu đồng5 gold badges24 silver badges48 bronze badges

    7

    Cho một chuỗi và tác vụ là xóa một ký tự khỏi chuỗi đã cho.

    Phương pháp 1: Sử dụng phương thức thay thế javascript ()JavaScript replace() Method

    Phương thức thay thế được sử dụng để thay thế một ký tự/chuỗi cụ thể bằng ký tự/chuỗi khác. Phải mất hai tham số, đầu tiên là chuỗi được thay thế và thứ hai là chuỗi sẽ được thay thế bằng. Trong trường hợp này, tham số đầu tiên là ký tự sẽ được xóa và tham số thứ hai có thể được đưa ra dưới dạng chuỗi trống. Điều này sẽ loại bỏ ký tự khỏi chuỗi. Phương pháp này loại bỏ sự xuất hiện đầu tiên của chuỗi.

    Syntax:

    string.replace('characterToReplace', '');

    Example:  

    HTML

    <html

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    1

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace('characterToReplace', '');
    4
    string.replace('characterToReplace', '');
    5
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace(/regExp/g, '');
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    2

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    string.substr(0, position - 1) + string.substr(position, string.length);
    0
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.substr(0, position - 1) + string.substr(position, string.length);
    8

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<______

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<<4 <5
    string.replace('characterToReplace', '');
    6<7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8html0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3<4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<html7 html8
    string.replace('characterToReplace', '');
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    00____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    03

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    05

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    07

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    09

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    10
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    11

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    13

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    23

    Output:

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    Phương pháp 2: Sử dụng phương thức thay thế javascript () với biểu thức thông thườngJavaScript replace() Method with a Regular Expression

    Phương pháp này được sử dụng để loại bỏ tất cả các lần xuất hiện của ký tự được chỉ định, không giống như phương pháp trước đó. Một biểu thức thông thường được sử dụng thay vì chuỗi cùng với thuộc tính toàn cầu. Nó sẽ chọn mọi lần xuất hiện trong chuỗi và nó có thể được xóa. & NBSP;

    Syntax:

    string.replace(/regExp/g, '');

    Example:  

    HTML

    <html

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    1

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace('characterToReplace', '');
    4
    string.replace('characterToReplace', '');
    5
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace(/regExp/g, '');
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<______

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    string.substr(0, position - 1) + string.substr(position, string.length);
    0
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.substr(0, position - 1) + string.substr(position, string.length);
    8

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<______

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<<4 <5
    string.replace('characterToReplace', '');
    6<7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8html0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3<4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<html7 html8
    string.replace('characterToReplace', '');
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    00____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    03

    Phương pháp 2: Sử dụng phương thức thay thế javascript () với biểu thức thông thường

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    24

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    09

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    10
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    11

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    13

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    23

    Output:

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    Phương pháp này được sử dụng để loại bỏ tất cả các lần xuất hiện của ký tự được chỉ định, không giống như phương pháp trước đó. Một biểu thức thông thường được sử dụng thay vì chuỗi cùng với thuộc tính toàn cầu. Nó sẽ chọn mọi lần xuất hiện trong chuỗi và nó có thể được xóa. & NBSP;JavaScript slice() Method

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    2

    Syntax:

    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);

    Example:  

    HTML

    <html

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    1

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace('characterToReplace', '');
    4
    string.replace('characterToReplace', '');
    5
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace(/regExp/g, '');
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    2

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    string.substr(0, position - 1) + string.substr(position, string.length);
    0
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace('characterToReplace', '');
    02

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<1 2
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    0851

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace('characterToReplace', '');
    21

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<1 2
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    275__71

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<<4 <5
    string.replace('characterToReplace', '');
    6<7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8html0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3<4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<html7 html8
    string.replace('characterToReplace', '');
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    00____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    03

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    05

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace('characterToReplace', '');
    60

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace('characterToReplace', '');
    62

    string.replace('characterToReplace', '');
    63
    string.replace('characterToReplace', '');
    64

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace('characterToReplace', '');
    66

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    10
    string.replace('characterToReplace', '');
    68

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace('characterToReplace', '');
    70

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    10
    string.replace('characterToReplace', '');
    72

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    13

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    23

    Output:

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    Phương pháp 4: Loại bỏ một ký tự cụ thể tại chỉ mục đã cho bằng phương pháp javascript () phương thức: & nbsp;JavaScript substr() method: 

    Phương pháp này có thể được sử dụng để xóa một ký tự khỏi một chỉ mục cụ thể trong chuỗi. Phương thức chuỗi con () được sử dụng để trích xuất các phần của chuỗi giữa các tham số đã cho. Phương thức này có hai tham số, một là chỉ mục bắt đầu và một là chỉ mục kết thúc của chuỗi. Chuỗi giữa các chỉ số này được trả về. Phần của chuỗi trước và sau khi ký tự được loại bỏ được tách ra và kết hợp với nhau. Điều này loại bỏ ký tự khỏi chỉ số cụ thể.

    Syntax:

    string.substr(0, position - 1) + string.substr(position, string.length);

    Ví dụ: & nbsp; 

    HTML

    <html

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    9

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    1

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    2
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    <

    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace('characterToReplace', '');
    4
    string.replace('characterToReplace', '');
    5
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    7____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.replace(/regExp/g, '');
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9____10

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    2

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace(/regExp/g, '');
    7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    string.substr(0, position - 1) + string.substr(position, string.length);
    0
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    string.substr(0, position - 1) + string.substr(position, string.length);
    8

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<1 2
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    0851

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    // Removing the first character
    string.slice(1);
    
    // Removing the last character
    string.slice(0, string.length - 1);
    9
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8<1 2
    string.replace('characterToReplace', '');
    6
    string.replace('characterToReplace', '');
    275__71

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8html0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3<4
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4<html7 html8
    string.replace('characterToReplace', '');
    6
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    00____10

    Phương pháp 4: Loại bỏ một ký tự cụ thể tại chỉ mục đã cho bằng phương pháp javascript () phương thức: & nbsp;

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    05

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace(/regExp/g, '');
    85

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace(/regExp/g, '');
    87

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    04
    string.replace(/regExp/g, '');
    89

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    8
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    13

    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    4
    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html7
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3
    string.replace('characterToReplace', '');
    0
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    0

    $('div.upme-field-value').html(function(i, html) {
        return html.replace(/\|/g,'');
    });
    
    3html
    $('div.upme-field-value').html($('div.upme-field-value').html().replace('|',''))
    
    23

    Output:

    Hướng dẫn how do you remove a character in html? - làm thế nào để bạn loại bỏ một ký tự trong html?

    Phương pháp này có thể được sử dụng để xóa một ký tự khỏi một chỉ mục cụ thể trong chuỗi. Phương thức chuỗi con () được sử dụng để trích xuất các phần của chuỗi giữa các tham số đã cho. Phương thức này có hai tham số, một là chỉ mục bắt đầu và một là chỉ mục kết thúc của chuỗi. Chuỗi giữa các chỉ số này được trả về. Phần của chuỗi trước và sau khi ký tự được loại bỏ được tách ra và kết hợp với nhau. Điều này loại bỏ ký tự khỏi chỉ số cụ thể.