Lance McGrew
asked on
CONVERT JAVASCRIPT BUTTON TO HYPERLINK TEXT
The current code displays a "button". I want code to just display text "Post Your Event" with same action as button does.
<script class="ai1ec-widget-placeh older" data-widget="ai1ecfs_widge t" data-button_size="md">
(function(){var d=document,s=d.createEleme nt('script '),
i='ai1ec-script';if(d.getE lementById (i))return ;s.async=1 ;
s.id=i;s.src='//live-timel y-0zd7rybd r3.time.ly /?ai1ec_js _widget';
d.getElementsByTagName('he ad')[0].ap pendChild( s);})();
</script>
<script class="ai1ec-widget-placeh
(function(){var d=document,s=d.createEleme
i='ai1ec-script';if(d.getE
s.id=i;s.src='//live-timel
d.getElementsByTagName('he
</script>
Can you please put that code in <code> <code>?It is very confusing the way it is now
ASKER
<script class="ai1ec-widget-placeholder" data-widget="ai1ecfs_widget" data-button_size="md">
(function(){var d=document,s=d.createElement('script'),
i='ai1ec-script';if(d.getElementById(i))return;s.async=1;
s.id=i;s.src='//live-timely-0zd7rybdr3.time.ly/?ai1ec_js_widget';
d.getElementsByTagName('head')[0].appendChild(s);})();
</script>
All that script does is load a widget (external javascript) that renders the button. To change it you would need to change the src it is referring to i.e
//live-timely-0zd7rybdr3.t ime.ly/?ai 1ec_js_wid get
In other words you would have to change the widget at src
What you can do is modify it after it is loaded.
This is tricky because the page loads and the button is created dynamically after this so you need to check when the button is created. To do this we need to listen for the DOMNodeInserted event and then run some JavaScript / jQuery to remove the button class from the widget.
We can do this with jQuery like so
Working sample here
//live-timely-0zd7rybdr3.t
In other words you would have to change the widget at src
What you can do is modify it after it is loaded.
This is tricky because the page loads and the button is created dynamically after this so you need to check when the button is created. To do this we need to listen for the DOMNodeInserted event and then run some JavaScript / jQuery to remove the button class from the widget.
We can do this with jQuery like so
<script src="http://code.jquery.com/jquery.js"></script>
<script>
$(function() {
$(document).on('DOMNodeInserted', function() {
$('a.ai1ec-btn').removeClass('ai1ec-btn ai1ec-btn-primary ai1ec-btn-md');
});
});
</script>
Working sample here
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Julian, I experimented with both your solutions and found the CSS method cleanest option. Works just fine. Your coding skills are certainly impressive. Thank you for taking quality time to share.
Thank you Lance and you are most welcome.