Cannot add a placeholder with jQuery [migrated]

Question

Why doesn’t my code add a placeholder text to the HTML?

HTML

<input type="text" name="EmailAddress" class="emailoctopus-custom-fields" tabindex="100">

myEdits.js

(function($) {
    $(document).ready(function() {
    //$('class:emailoctopus-custom-fields').attr('placeholder','Some New Text');
    $('input[type=text].emailoctopus-custom-fields').attr('placeholder','Some New Text');
    })
})(jQuery); 

Functions.php

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

add_action( 'wp_enqueue_scripts', 'add_codecanal_plugin_script' );
function add_codecanal_plugin_script() {
    wp_register_script('plugin-script',get_template_directory_uri() . '/js/myEdits.js',array('jquery')); 
    wp_enqueue_script('plugin-script');

}
0
, JohnDem 6 months 0 Answers 88 views 0

Leave an answer