开发者

problem with jquery .hide()

Hey guys I've got a simple problem with jQuery but to be honest it don't get it what I'm doing wrong.

The JQuery code just looks like that

$(".submit_twitter,.submit_url").hide();
$(".submit_url").show();

Now I expect to see only the submit button with class="submit_url", but instead both submit buttons are shown? ;(

Using just

  $(".submit_twitter").hide();

instead didn't work either.

EDIT:

I'm using it like that right now:

$(".submit_twitter,.submit_url").hide();
$(".submit_url").show();
$(".url2,.notsignedin").hide();
$(".counter").hide();

it works as far as it doesnt show classes "url2", "notsignedin" and "counter" but submit classes are shown. functions are called from an extern .js file which starts with:

jQuery(document).ready(function() { .......

As you see it is pretty strange why some parts do work and others dont.

EDIT 2 - fixed: ah found the problem myself, had another function which was using keyup event, the开发者_Go百科re the input length was used to show/hide the submit_twitter button like if (len > 140) hide button, else show button, this function was responsible for showing the button all the time as the len was ofcourse less then 140 characters.


  • make sure you used the same class name on element and jquery selector (submit_twitter)
  • make sure your script executes after element is added to DOM
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜