count special characters from string in jquery
===

    var temp = "/User/Create";
    alert(temp.count("/")); //should output '2' find '/'

i will try this way

    // the g in the regular expression says to search the whole string 
    // rather than just find the first occurrence
    // if u found User -> var count = temp.match(/User/g);
    // But i find '/' char from string
    var count = temp.match(///g);  
    alert(count.length);

u can try here [http://jsfiddle.net/pw7Mb/][1]


  [1]: http://jsfiddle.net/pw7Mb/