SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a requirement where in i have to set the link of the CEWP using jquery on a button click. The approach i was thinking of is : On button click , find the CEWP on the page. Change the link to the desired link.

But here, i am unable to find a script to search the CEWP on the page and change its link.

Can some one please help as it is urgent !! Please let me know, in case i am unclear anywhere in the explanation.

share|improve this question

Why would you want to find the CEWP? If you add an ID to the link you want to change, just set your selector to that ID and you should be good to go.

$(document).ready(function () {
    $('#myLinkID').attr('href', 'new link here');

Always make sure to have IDs or somewhat unique classes you can use as selectors to better narrow down where the jquery should do changes.

Hope this helps :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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