Hi, you can try below code.
(function($) {
//my $ object is local now
$(“#check_addon input”).attr(“disabled”, true);
$(‘input[type=”radio”]’).click(function(){
if ($(this).is(‘:checked’))
{
$(“#check_addon input”).attr(“disabled”, false);
}
});
})(jQuery);
Hi,
Tested. It’s only working while it’s in HTML. Once I added in the wordpress page. It’s not working anymore.
Hi,
I found that the script can’t add in the contact form 7, need to add in at the page.
Thank you for your help. 🙂
-
This reply was modified 9 years, 1 month ago by
jessezy.
Hi All,
sorry that another problem. If I add in this jquery :
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script>
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
The form is working. But my slider not working. If I remove this JQuery, the form is not working. 🙁
what should I do?
-
This reply was modified 9 years ago by
bdbrown.
Hi @jessezy
I have your solution. Do this exactly, very carefully:
First, create a “.js” fille inside a folder called “js” inside your child-theme (important to have a child theme so it won’t brake or be lost in the next update).
Let’s say: “scriptNameHere.js”
Forget jquery.min file… it’s already loaded by your theme, almost certain.
Your code isn’t properly done. First, … identation for good sake!
Then, You’ll need to use something like this:
jQuery(document).ready(function($) {
// vars here
// your functions here
}
in that “scriptNameHere.js” file
Finally you’ll need to call the “js” file in your childtheme’s functions.php using an action:
function add_custom_script() {
wp_enqueue_script( 'scriptNameHere', get_stylesheet_directory_uri() . '/js/scriptNameHere.js', array ( 'jquery' ), 1.0, true);
}
add_action( 'wp_enqueue_scripts', 'add_custom_script' );
Voilà!!
Hope that helps.