jQuery使用空格读取属性值
我有以下html:
...
如何用jQuery读取type
属性?
我试过这个:
var type = $(".movie").attr("type");
但type
只包含Text
。
更新:
这就是我使用这个变量的方式:
$("#publicationBlock").load("/Publication/EventSchedule?eventId=" + eventId + "&type=" + type
在动作中,我只获得Text
。
应该工作。
var type=$(".movie").attr("type"); alert(type);
在这里摆弄 ..
看你是否错过了这个。
1)确保你的代码在ready函数$(function(){
..
2)检查jquery版本..最新更好
更新
...
并在EventSchedule
函数中使用’_’进行爆炸
我没有在这里看到问题?
此示例与您的代码完全相同,但它能够显示整个属性: http : //jsfiddle.net/rFYpE/
var type = $(".movie").attr("type"); alert(type);
你是如何使用变量类型的?