Posted By

jbernus on 07/18/11


Tagged

javascript jquery


Versions (?)

Get a part of a class name


 / Published in: jQuery
 

URL: http://groups.google.com/group/jquery-en/browse_thread/thread/712929ba52f18775

  1. var classes = $(".item").attr("className").split(" ");
  2. for(var i = 0; i < classes.length; i++){
  3. if(classes[i].substr(0,3) == "id-"){
  4. var theId = parseInt(classes[i].split('id-')[1]);
  5. }
  6. }

Report this snippet  

You need to login to post a comment.