How to deal with quotation

Discussion in 'JavaScript' started by noobee, Aug 29, 2009.

  1. #1
    how to deal with this kind of problem

    for example:

    <img src='abc.jpg' onclick='$("#abc").load("abc.php?value=abc's");'>

    the problem is in abc's
     
    noobee, Aug 29, 2009 IP
  2. The PHP Guy

    The PHP Guy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Change it to:
    <img src="abc.jpg" onclick="$('#abc').load('abc.php?value=abc\'s');">
    HTML:
    This also makes the tag XHTML compliant (if you add a / before >)
     
    The PHP Guy, Aug 30, 2009 IP
  3. morehawes

    morehawes Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Including the backwards slash is called "escaping" the character.
     
    morehawes, Sep 11, 2009 IP