Jquery Problem With Changing Element Attribute In Internet Explorer -
i using jquery create dynamic links based on user input. have set of elements in ajax loaded div looks this
<div class="mxcell"> <input type="text" size="40" class="input_name" value=""> <a href="#" target="_blank" class="dyn_link"> <img src="http://127.0.0.1/images/arrow_right.gif"> </a> </div>
now in jquery write
$(function(){ $("#right").delegate(".input_name", "change", function(){ var dyn_link = $(this).val() $(this).parent().find("a").attr("href", "http://www.example.com/"+ dyn_link +".html"); }); });
this works fine in chrome/firefox, not in internet explorer.
any ideas?
ie debugger pointed jquery line 69 character 15. wouldn't know investigate further.
update:
i solved above using focusout() instead of change()
but not still sure whether there better solution
i'd keyup
instead of focusout
, , cleaned href changer bit:
$("#right").delegate(".input_name", "keyup", function() { var $this = $(this); var dyn_link = $this.val(); $this.next("a").attr("href","http://www.example.com/" + dyn_link + ".html"); });
Comments
Post a Comment