Qhov no yog ib qho rau kuv kuas series yuav ua li cas los siv jQuery nrog SharePoint.
Yog koj xav paub ntau ntxiv txog cov jQuery, Kuv mas xav: jQuery hauv nkaus ntawm Xyooj Bibeault thiab Yehuda Katz.
HLOOV TSHIAB (twb!): Kuv tsis xav tias muaj ib txoj kev zoo los nrhiav lub <TR> Kuv xav mus nkaum lossis thiab sau tau hais txog nws ntawm no. Koj kuj tseem nrhiav tau no Tshooj nthuav lawm ces kuv leavnig nws mus.
Kuv xav mus nkaum teb ntawv nyeem, "Nraim kuv!"thaum pom tias cov:
Cov nram qab no jQuery puas muaj qhov ua kom yuam kev rau kuv:
<Script yam ="ntawv nyeem/javascript"> $(muaj nuj nqi() { $(' input[Title = nraim kuv!]').niam txiv().niam txiv().niam txiv().nkaum(); }); </tsab ntawv> |
Txoj cai hais tias, "xyuas nws npe fields input tag kuv = kuv nkaum!. Ces, tau nws cov niam txiv thiab cov ntawd ntxiv mus leej niam leej txiv thiab tus * * ntxiv mus leej niam/txiv (phew!) thiab ua tau rau tus muaj lub hide() txujci nyob ntawd tshaj plaws, txawm nws yuav tsis muaj.
Kuv figured tawm ntawd cov qauv niam/txiv uas saib cov HTML rau hauv daim ntawv ntawd SharePoint tsim li:
<TR> <TD nowrap= "nws muaj tseeb" valign= "top" dav= "190px" hoob= "ms-formlabel"> <H3 hoob= "ms-standardheader"> <nobr>Kuv nkaum!</nobr> </H3> </TD> <TD valign= "top" hoob= "ms-formbody" dav= "400px"> <!-- FieldName = "nraim kuv!" FieldInternalName = "Hide_x0020_Me_x0021_" FieldType = "SPFieldText" --> <ntsua kev dir= "All"> <tswv yim lub npe= "ctl00$ m$ g_bdb23c2c_fde7_495f_8676_69714a308d8e$ ctl00$ ctl04$ ctl02$ ctl00$ ctl00$ ctl04$ ctl00$ ctl00$ TextField" hom= "ntawv nyeem" maxlength= "255" tus ID= "ctl00_m_g_bdb23c2c_fde7_495f_8676_69714a308d8e_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_TextField" npe= "Nraim kuv!" hoob= "ms-ntev" /> <br> </ntsua kev> </TD> </TR> |
Cov duab no qhia tau hais zoo li qub, tab sis ntawv rau cov niam txiv:
Thawj cov txiv (1) yog ib tug siab txog lossis. Tham nrog tus txiv (2) yog ib lub lossis TD thiab ces thaum kawg peb tau mus rau ntawm txiv kuv xav mus nkaum (3) Nws yog ib qhov TR lossis nws tus kheej.
Qhov no yog ib tug zoo nkauj heev tas zog kuv xav tias vim nws yog ib feem nyob daim qauv ntawm daim ntawv no kav. Thaum SharePoint 2010 ua li, qhov qauv tseem yuav hloov thiab lov no mus kom ze. Kuv yeej xav tau dabtsi ua yog khoom siv tes ua ib jQuery selector uas yog ib tus kab uas "nrhiav kuv txhua lub TR tus (thiab TR cim npe xwb) uas muaj qhov chaw nyob hauv lawv tus me nyuam hais ib input teb uas txoj kev cai title = nraim kuv!”. Txij qab thiab mus. Piv txwv tias yog kuv paub qhov no tseeb, Kuv mam li tswg kev kho tshiab "txoj kev sai thiab yooj yim ' tswg.
</kawg>
Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin
yuav ua cas no mus kom ze rau kev nrhiav tau tus niam/txiv tr? Thawj zaug ntawm nyob rau hauv cov sau cov txwv zeej txwv koob cov ntshav uas yog tr hais, Thaum kawg yuav ua rau lub qhov txiv tr.
.cov niam txiv("tr:yog thawj tug")