第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么無(wú)法修改type屬性?

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

? ? <head>

? ? ? ? <title>live()方法綁定事件</title>

? ? ? ? <script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script>

? ? </head>

? ? <body>

? ? ? ? <h3>live()方法綁多個(gè)事件</h3>

? ? ? ??

? ? ? ? <script type="text/javascript">

? ? ? ? ? ? $(function () {

? ? ? ? ? ? ? ? data={type:'text'};

? ? ? ? ? ? ? ? $("input").live

? ? ? ? ? ? ? ? (

? ? ? ? ? ? ? ? ? ? "click mouseout",data,function ()?

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? $(this).css("type",data.type);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? );

? ? ? ? ? ? ? ? $("body").append("<input id='btntest' type='button' value='點(diǎn)擊或移出就不可用了' />");

? ? ? ? ? ? });

? ? ? ? </script>

? ? </body>

</html>


正在回答

3 回答

還有,一樓說(shuō)的很對(duì),不可能用css() ? 只可能用attr() ? 附一端代碼你理解下:

$(function () {

? ? ? ? ? ? ? ? var data={value:'test ?test'};

? ? ? ? ? ? ? ? $("input").live

? ? ? ? ? ? ? ? (

? ? ? ? ? ? ? ? ? ? "click",data,function ()?

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? alert(data.value);

? ? ? ? ? ? ? ? ? ? $(this).attr("value",data.value);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? );

? ? ? ? ? ? ? ? $("body").append("<input id='btntest' type='button' value='點(diǎn)擊或移出就不可用了' />");

? ? ? ? ? ? });


0 回復(fù) 有任何疑惑可以回復(fù)我~

查了好久:

首先:

type屬性是?read/write-once?的,?只在初始化時(shí)set。
要么用新的元素取代舊的元素

然后:?

jquery是無(wú)法input 標(biāo)簽的type屬性 ? 但是原生的 js 是可以的,但是只有firefox支持 ,IE下是不支持修改type屬性的. 如果非要改 ? 有一個(gè)解決辦法:變相改,就是 先把它刪了,然后創(chuàng)建一個(gè).嗯 就是這樣

0 回復(fù) 有任何疑惑可以回復(fù)我~

?$(this).css("type",data.type);?

css 只能添加樣式的屬性,這里應(yīng)該用元素屬性attr。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
jQuery基礎(chǔ)課程
  • 參與學(xué)習(xí)       154723    人
  • 解答問題       7289    個(gè)

加入課程學(xué)習(xí),有效提高前端開發(fā)速度

進(jìn)入課程

為什么無(wú)法修改type屬性?

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)