Support » Fixing WordPress » html js not working in wp

  • Resolved emaarkhan

    (@emaarkhan)


    hi,
    I m converting my html site to WP and i am trying to make the slide work which works perfectly in html website.i tried jQuery simple alert it works but the script isn’t.wht seem to be wrong?

Viewing 15 replies - 1 through 15 (of 27 total)
  • your script is commented remove // before line

    yes it removed. the version i showed as an example was when it was doing nothing. the comments are removed.

    can you share url?

    its on localhost. i think you can run that script on ur local environment too.can?

    i can run that script but i want to see the html.

    its on localhost. i think you can run that script on ur local environment too.can?

    What OS? What Browser? Which AV? Typically local host blocks running unknown scripts

    i can run that script but i want to see the html.

    here

    What OS? What Browser? Which AV? Typically local host blocks running unknown scripts

    Mac OS. Firefox, what’s AV.well as for now i m pasting that code in header.php, as i had some issue that my script.js won’t load.so first i did a jquery alert. when that worked in header.i pasted that

    seems wrong $fw("#galleryhdr") change that to $("#galleryhdr")

    No, that didn’t work. did it worked on ur end?

    give me code of header.php

    give me code of header.php


    here

    if your wondering, why didn’t i put the code in script.js as directed in header file. the script.js wasn’t loading.so i check to see if the jquery is working and it was. so i managed to put the code in header. so it work

    Where is jquery.js and where is fwShowcase.js?

    jquery is loading from wp-include using

    function my_scripts_method() {
    	wp_enqueue_script(
    		'newscript',
    		plugins_url('/scripts/script.js', __FILE__),
    		array('jquery')
    	);
    }
    add_action('wp_enqueue_scripts', 'my_scripts_method');

    as for the fwShowcae.js, i missed that but its added after script.js
    like`<script type=”text/javascript” src=”scripts/fwShowcase.js”></script>
    <script type=”text/javascript” src=”scripts/fwShowcasea.js”></script>
    <script type=”text/javascript” src=”scripts/fwShowcasec.js”></script>`

    make sure fwShowcase.js is properly loaded before script.js

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘html js not working in wp’ is closed to new replies.