jQuery常用选择器
in js with 0 comment

jQuery常用选择器

in js with 0 comment

基本选择器

//id 选择器
$('#test1').css('background','gray');
//标签选择器
$('p').css('background','blue');
//类选择器
$('.test2').css('background','green');
//*
$('*').css('background','pink');

层次选择器

//div下的span
$('div span').css('background','blue')
//紧挨着的下一个元素,每一个元素之后的1个next元素被选中
$('input + span').css('background','gray');
//紧挨着的所有同辈元素,每一个元素之后的所有同辈元素
$('input ~ span').css('background','gray');

属性选择器

//type选择
$('input[type=password]').css('background','gray');
//name 选择
$('input[name=email]').css('background','green');
//name不等于email
$('input[name!=email]').css('background','red');
//正则选择
$('input[name$=password]').css('background','orange');//都用password结尾的
$('input[name^=stu]').css('background','blue');//开头是stu
$('input[name*=pass]').css('background','orange');//含有pass

自定义属性

<p>Email:<input type="text" aa='s' name="email" /></p>
$('input[aa=s]').css('background','green');
Responses
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif
  1. @

    Propecia Andropel viagra Amoxicillin Baby Rash Pharmacyonline Store Nolvadex Dose generic cialis from india Amoxicillin Doses For How Long Amoxicillin 875 Mg For Ear Infections How Much Is Cialis Prescription Macrobid Buying Overseas buy viagra online Aldactone Online No Presc Danni Propecia Original Viagra Bewertung Propecia Low Dose Online Phamaces Propecia Testicle Cancer cialis o propecia 2061 Buy Malegra Dxt 130 Mg Cephalexin And Strep A Cialis Non Prescription Levitra Verschreibungspflichtig viagra Conseil Utilisation Du Viagra Kamagra Prescrizione Montreal Buy Cheap Generic Valtrex Can I Purchase Pyridium No Physician Approval On Line Generic Female Cialis tadalafil cialis from india Canadian Synthroid Without A Script Levitra Effets Secondaires

    Reply
  2. @

    Best Buy Fluoxetine viagra Achat Xenical Ligne

    Reply