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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -