Escape single quotes in title - Javascript String Operation

Javascript examples for String Operation:String Quote

Description

Escape single quotes in title

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  w ww. jav a2  s. com*/
myTitle = "abc '' def";
document.write('<img title="' + myTitle + '" src="http://www.java2s.com/style/download.png" />')
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials