wordpress - Jquery - Replacing a Dom Element on load -
i need replace following html element
<input type="submit" id="send_product_enquiry" value="send enquiry" class="button">
with this
<input type="submit" id="send_product_enquiry" onclick="ga('send', 'event', { eventcategory: 'contact enquiry', eventaction: 'form entry', eventlabel: 'contact form enquiry'});" value="send enquiry" class="button">
i've been trying use
jquery(document).ready(function($) { $('#send_product_enquiry').replacewith('<input type="submit" id="send_product_enquiry" onclick="ga('send', 'event', { eventcategory: 'contact enquiry', eventaction: 'form entry', eventlabel: 'contact form enquiry'});" value="send enquiry" class="button"> ' ); });
but keep getting below error
"missing ) in argument..."
i know it's syntax thing double or single quotes, don't know right. been messing around no results.
add click handler jquery.
$('#send_product_enquiry').on('click', function () { ga('send', 'event', { eventcategory: 'contact enquiry', eventaction: 'form entry', eventlabel: 'contact form enquiry' }); });
Comments
Post a Comment