Reputation: 4198
I am wondering if there is a possibility to change href attr inside CKEDITOR.
I have an check box outside ckeditor with class email-checkbox, and ckeditor text box wth generated text. Inside this generated text is a href with id open-redirect, now I want to add value to href of this link. This is single link unique and is always in generated message. My code looks for now:
$(document).ready(function(){
carrier.add();
});
var carrier = {
add: function(){
$(".email-checkbox").click(function(){
var values = $('input:checkbox:checked.email-checkbox').map(function(){return this.value;}).get();
var href = $('#open-redirect').attr('href');
{now href is undefined and I need to add checkbox value to it}
});
}
};
Upvotes: 0
Views: 195
Reputation: 128791
Instead of using click()
instead use change()
:
$(".email-checkbox").change(function(){
if (this.checked) {
$('#open-redirect').attr('href', this.value);
}
});
Upvotes: 1