简体   繁体   中英

select html element in external jquery file

A quick question. Is it possible to select ( html ) element in external .js file using jquery ?

I have abc.js file and a xyz class . Why following code is not working?

//abc.js

$('.xyz').hide();

Yes.This is possible.your code structure would be as Following:

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="js/abc.js"></script>

your abc.js code:

$(function(){ 

$('.xyz').hide();

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM