Wednesday, 3 July 2019

How to reload/refresh an element (image) in jQuery

///////////// HTML


<div id="mrnimgdiv" class="border p-10">

 <img src="../folder/abc.png" alt="" style="width:100%; max-height:250px;" />

  </div>

/////////////// jquery


function refreshimg () {

$("#imgid").attr("src""/xyz.jpg?timestamp=" + new Date().getTime());

            }



Result//

<div id="mrnimgdiv" class="border p-10">


 <img src="../folder/xyz.png" alt="" style="width:100%max-height:250px;" />

  </div>

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...