function won't return q -Javascript -


i have following function:

  "use strict";     $(document).ready(function(){         $("#slider,input[type='range']").on("mousemove touchmove ",function(){             $("#test").html($(this).val())         });     });          function addclass(){             var q=0;             var p=prompt("enter class(es) want add seperated ','");             var to_be_added=[];             to_be_added=p.split(",");             (var j=0;j<to_be_added.length;j++){                 if(to_be_added[j][0] === "."){                     to_be_added[j]=to_be_added[j].slice(1);//check if first character of each class inside array contains "." , remove                 }             }             (var k=0;k<to_be_added.length;k++){                 $("#slider").addclass(to_be_added[k]);                 q++;             }             return "q";         }         function delclass(){             var q=0;             var p=prompt("enter class(es) want remove seperated ','");             var to_be_added=[];             to_be_added=p.split(",");             (var j=0;j<to_be_added.length;j++){                 if(to_be_added[j][0] === "."){                     to_be_added[j]=to_be_added[j].slice(1);//check if first character of each class inside array contains "." , remove                 }             }             (var k=0;k<to_be_added.length;k++){                 $("#slider").removeclass(to_be_added[k]);                 q++;             }             return "hello";          } 

html:

<button onclick="delclass()">delete</button> 

the problem after running above code don't in console.not undefined.any ideas?jquery included , $("#slider") correct. update if call function console "hello" in console when use button call function nothing

when use button call function nothing

this expected. console not show return value of every function executes in code. if manually execute code in console, console show result of execution. different having code execute in page.

returning value event handler nothing, , not output console.

if want display value in console, use console.log:

console.log("hello"); 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -