Answer the question
In order to leave comments, you need to log in
How to remove an attribute and then put it back?
You need to do a sequence of actions when you click on the button: remove all attributes from certain objects, add an attribute associated with the clicked one and run a script. Here is my code that I think should do it:
$('.push').click(function(){
$('.del').removeAttr('id');
this.next('div').children('.del').setattr('id', 'disqus_thread');
var disqus_shortname = 'allfreecourses';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
})
Answer the question
In order to leave comments, you need to log in
$('.push').click(function(){
$('.del').removeAttr('id');
$(this).next('div').children('.del').attr('id', 'disqus_thread');
var DIS_SHORT = 'allfreecourses',
dsq = document.createElement('script');
dsq.async = true;
dsq.src = 'http://' + DIS_SHORT + '.disqus.com/embed.js';
(document.head||document.body).appendChild(dsq); //Как head'a может не быть???!?
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question