Mithun Das
Mithun Das

Reputation: 11

button click and automatic select radio buttons in contact form 7

I have created a page in WordPress (http://phototechnolabs.com/fashion-photo-editing). Now at the Pricing table If I click on the button it must go down and select the radio button option automatic.

For Example, If I am clicking on the gold pricing table button it should go down and select the gold radio button automatic.

I am using contact form 7.

<p>[text* Name: placeholder "Name:"]</p>
<p>[email* Email: placeholder "Email:"]</p>
<p>[tel* Phonewithcountrycode: placeholder "Phone with country code:"]</p>
<b>Select Your Plan*</b>
<p>[radio Package id:Package  "Silver" "Gold" "Platinum" "Custom"]</p>
<p>[file FileUpload limit:50000000 filetypes:gif|png|jpg|jpeg]</p>
<p>[textarea* DiscribeYourRequirement: placeholder "Brief your Requirement:"]</p>
<p><center>[submit "GET A FREE TRIAL"]</center></p>

Upvotes: 0

Views: 1076

Answers (1)

Jainil
Jainil

Reputation: 1496

You can do that using the jQuery

Add the data-value="Gold" attribute to the button. Pass the same value as radio buttons on each button.

Then add the following script:

jQuery( ".pricing-plan-list .btn-pricing" ).click( function() {
    var planVal = jQuery( this ).data( 'value' );
    jQuery( "input[name=Package][value=" + planVal + "]" ).prop( 'checked', true );
} );

Upvotes: 1

Related Questions