我想要一點jQuery代碼,當我單擊文本框時,將允許我找到控件的標籤...所以在我的HTML中我有這樣的代碼:使用jQuery爲所選控件或文本框查找標籤
<label id="ctl00_WebFormBody_lblProductMarkup" for="ctl00_WebFormBody_txtPriceAdjustment">This Is My Label Value</label>
<input type="text" style="width:29px;" onclick="alert('label value here');" title="Here is a title" id="ctl00_WebFormBody_txtPriceAdjustment" maxlength="3" name="ctl00$WebFormBody$txtPriceAdjustment">
所以,當我點擊我的文本框,我希望(例如)做的警報......與我的標籤中的文本 - 所以在這種情況下,它會提醒「這是我的標籤值」
希望是有道理的:)
的用於在標籤標記屬性應該對應於ID屬性上輸入。 –