我想要一些jQuery代码,当我点击文本框时,我可以找到控件的标签...所以在我的HTML中我有这个:
<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">
Run Code Online (Sandbox Code Playgroud)
因此,当我点击我的文本框时,我希望(例如)使用我标签内的文本进行警告...所以在这种情况下它会提醒"这是我的标签值"
希望有道理:)