开发者

Cannot call method remove of null

开发者 https://www.devze.com 2023-02-15 14:00 出处:网络
I do not understand why this is evaluating to be null. Here is the offending code: Javascript (jQuery) call:

I do not understand why this is evaluating to be null. Here is the offending code:

Javascript (jQuery) call:

<a href="javascript:;" onmousedown="pheonixTag();">,  
  <%= disp %> 
</a>

Javascript function:

function pheonixTag() {  

  $("#outer_block").remove();

}

Relevant bit of HTML:

<div id="outer_block"> stuff
  <div id="inner_b开发者_C百科lock"></div>
</div>

When i make this call i get the error: Cannot call method remove of null. what gives?


It means that $("#outer_block") returns a null reference instead of the real object. I believe you should use $("outer_block")


I suggest dropping down to a dev console or Firebug in Firefox.

From there I would check for returned js errors and type in my selector query on the console to test it's returning an object.

Where is your function phoenixTag?

0

精彩评论

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