I'm using the below code to add an attribute to my gravity forms form tag. But there seems to be a problem with the "toLocaleString('en-US')" part. I assume this is a quote issue? As there's single quotes being used inside single quotes.... How can I fix this?
<?php
add_filter( 'gform_form_tag', 'form_tag', 10, 2 );
function form_tag( $form_tag, $form ) {
if ( $form['id'] != 1 ) {
return $form_tag;
}
$form_tag = str_ireplace( "<form ", "<form oninput='loanval.value=parseInt(loan.value, 10).toLocaleString('en-US'); periodval.value=period.value;' ", $form_tag );
return $form_tag;
}
?>