php - jQuery don't load for a child theme in Wordpress -


i add html code in child theme add icon in child theme in wordpress. currently, that's :

first

and add youtube icon (that's not in theme, that's why want add html) :

second

so set function.php code :

    <?php  function mytheme_scripts() { wp_enqueue_script('mytheme_functions', get_stylesheet_directory_uri().'/js/myscript.js', array('jquery'), '', true); wp_enqueue_script('jq_ui', get_stylesheet_directory_uri().'/js/jquery-ui-1.10.3.custom.min.js', array('jquery')); //not sure if can use cdn here instead of local version. } add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );  ?> 

here jquery code :

 $(document).ready(function($) {   $(".social-google-plus").append('<li class="social-youtube"><a href="http://www.twitter.com/tworldangels" target="blank"><i class="fa fa-youtube"></i></a></li>');   }); 

my jquery code in /js folder in child theme. doesn't work. wrong ? guys !

i quite sure mine loads right.

perhaps $ generating issue (is how wordpress prevents conflicts between js libraries).

try following:

jquery(document).ready(function($) {      $(".social-google-plus").append('<li class="social-youtube"><a href="http://www.twitter.com/tworldangels" target="blank"><i class="fa fa-youtube"></i></a></li>'); }); 

(i haven't tested code)

if not resolve it, can provide further details? console errors?


Comments