开发者

Changing form input type using jquery

Hi I am trying to change the type of <input> from submit to image using jquery so that the image is displayed during the AJAX request instead of 开发者_StackOverflow社区the button. I am doing:

    $(document).ajaxStart(function(){$("#submit_btn").removeAttr("type").attr("image");});  

and my HTML is:

<input type="submit" name="submit" class="button" id="submit_btn" value="Send" src="images/sending.gif" />

Am I doing it the right away? And if so, what's wrong because this ain't working :p


I think you're looking for:

$(document).ajaxStart(function(){$("#submit_btn").attr("type","image");});

Using attr() to set the attribute, rather than removing it.


May be this work for you:

$(document).ajaxStart(function(){$("#submit_btn")..attr(type : 'image');}); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜