Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Searching for bullets

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35311
    XaviJr
    Participant

    Hi guys!

    I have this code in jQuery code to search a bullet in the html inside a div:

    var preHTML = $(this).html();
    alert(preHTML.search(">•"));

    The problem is that search returns -1. I already confirmed that the bullet is there so it must be some problem with the search function.

    Is there any other way to replace “>[bullet]text” for “>text”?

    Thanks in advance.

    #91257
    XaviJr
    Participant

    So there’s no way to search for that bullet code?

    I will try the alternatives you presented.

    #91258
    Mottie
    Member

    Try this (demo):

    $(this).html(function(i,h){
    return h.replace(/u2022/g,'>');
    });

    The “u2022” is the javascript version of the HTML “•”

    #91259
    XaviJr
    Participant

    Worked great, thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.