开发者

Why my whole code is not working?


See I have been creating a Country selector. And in my previous question - dampe (accepted), jammon, Jani Hartikainen, prodigitalson helped me a lot! They provided me a code that was working in my jsFiddle but when transferred it to my real html page , I guess it is not working because when I select any Country (Element type a开发者_C百科/link and classed country_link) my input (classed country_input) value does not changes to that country! I don't know what is getting wrong with my code, so I thought to you ask for help from you guys. Can anyone help me out. (Below is my problem's jsFiddle page!)

Problem Page

THANKS IN ADVANCE


The problem is that you country-selectors gets hidden away BEFORE it assigns the value to the element and in such case javascript dosen't 'see' the object you are trying to get the value from.

In other words: you have to hide the country list AFTER you have taken the value from the link as such:

 $(".country_link").click(function(){
       $('input.country_input').val($(this).text());
        $('div.country_selecter').hide(); //this action was on your blur event, whcih basicly was triggered as soon as you blured ou

                            });

Edit: I also updated your fiddle code

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜