Function in javascript

1

Colleagues.

I have a file called somar.js that I'm calling in the page index like this:

 <script src="js/somar.js"></script>

The file exists and is correctly inside the folder on the server, however when I place the command below in the file somar.js:

function soma(){
    alert('OK...vamos continuar');
.......

It does not seem to work. I am calling this file as follows on the index page:

<select name="QtdAcomodacaoS" id="QtdAcomodacaoSingle" class="form-control" style="width:130px" onchange="soma()">

Could it be that by using the bootstrap, it may be causing some conflict? I put it before the body.

    
asked by anonymous 23.09.2015 / 14:24

1 answer

2

Specifies the file type as text/javascript .

 <script type="text/javascript" src="js/somar.js"></script>

And put before closing the </body> tag.

An example using <select> .

link

    
23.09.2015 / 14:29