javascript - replace onclick in a string -


I have a Texter in which there are many images all the images have an ID and I want a loop through all those pictures And check whether an onclick event (depends on ID) is required if I do not need an onclick event so I need to check what it is and remove it. If need II still need to remove it and add another (because the value of onclick can be changed)

How can I do this?

  & lt; Img id = "SlideShowImage_3" style = "border: 1px solid black; cursor: indicator;" Title = "3" onclick = "loadSlideShow ('7', 'open', '3', '', '2')" src = "upload / nieuws / 7 / 1363788115.jpg" alt = "3" / Gt; & Lt; Img id = "slideShowImage_3" style = "border: 1px solid black; cursor: indicator;" Title = "3" src = "upload / nieuws / 7 / 1363788115.jpg" alt = "3" />   

Try it out:

  function cleanCode () {var container = $ ('& lt; div & gt;' + $ ('# text1'). Val () + '& lt; / div & gt;'); Container.find ('img') removeAttr ('onclick'). . $ ('# Text2') HTML (container.html ()); }   



Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -