Posted By

EvanHahn on 03/12/12


Tagged

jquery id selector


Versions (?)

JavaScript IDify


 / Published in: JavaScript
 

This prepends a # if it's not already there. Useful when doing jQuery selectors.

  1. Evan.idify = function(id) {
  2. if (id[0] !== '#') return '#' + id;
  3. return id;
  4. }

Report this snippet  

You need to login to post a comment.