Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.