I have sharepoint 2013 rich text control in page-layout.After adding image in rich-text control ,I am not able to get any html object using js.I am using below line to alert div object.


It alerts null after adding image in rich-text control.But it works (alert [object]) if I add any content exclude image.And don't have any other js errors in page.Don't know why this control is behaving like this and this behavior is same in all the browsers.

  • This is working correctly guys you can use it.
    – wArLoCk
    Nov 13, 2018 at 12:38

2 Answers 2


I found the solution.Use jQuery instead $.Don't know why it is behaving like this.So now I have assign jQuery to $ and it works.

$ = jQuery; alert($('#linkMainImgDiv').html())

  • 1
    That's because somebody very smart at Microsoft decided it'd be a good idea to assign some sharepoint internal value to a $ variable, thus breaking jQuery. Sep 22, 2014 at 6:54



First check in you page source that even this id exist or not. If exist then try it in your debugger tool of browser.

Can you share your markup or any screenshot with div.

  • But $('#linkMainImgDiv') is null.
    – Heena
    Sep 20, 2014 at 8:22
  • Yes, It is exist in page source and also try to debug but it shows null.
    – Heena
    Sep 22, 2014 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.