WordPress.org

Ready to get started?Download WordPress

Forums

js not working (12 posts)

  1. emaarkhan
    Member
    Posted 1 year ago #

    hi all,
    i am making a conversion of html to wordpress and my code works perfect in html but it doesn't work in wordpress.for now i am adding it to header.php. can anyone help me out on why it isn't working. help?

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    You need to review Using_Javascript.

  3. emaarkhan
    Member
    Posted 1 year ago #

    so just include and enqueue it?

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    Don't include it. Just enqueue it. :-)

  5. emaarkhan
    Member
    Posted 1 year ago #

    i did as in according to using js. but its not working. it is however loading the file as i saw in the source

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    Then I can only guess that there's an issue in the js file itself.

  7. emaarkhan
    Member
    Posted 1 year ago #

    not really coz i tried simple alert.that's not popping up :-/

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    Does it rely on any other jQuery component? Did you ensure that you used Query noConflict wrappers?

  9. emaarkhan
    Member
    Posted 1 year ago #

    Nope, wordpress comes with enqueue jQuery.no?? i donno bt noConflicts thing

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    wordpress comes with enqueue jQuery

    Yes.

    i donno bt noConflicts thing

    See this Codex section.

  11. emaarkhan
    Member
    Posted 1 year ago #

    i got pretty big .js file. how do i wrap no conflicts around it?

  12. emaarkhan
    Member
    Posted 1 year ago #

    I enqueue the following code in header just to see if it loads in source file but it isn't

    if(!is_admin()){
    	wp_deregister_script('jquery');
    	wp_register_script('jquery',
    	('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'),false);
    	wp_enqueue_script('jquery');
    }

Topic Closed

This topic has been closed to new replies.

About this Topic