lilmer Posted April 24, 2013 Share Posted April 24, 2013 Good day, I've got a problem getting the value of the parameter on a function I've got this code to append on my div $(' .'+type).append(' <a href="#" id="'+type+'-'+desId+'" class="admin-managers"> <span class="admin-managers" id="'+name+'">'+name+'</span> <span id="'+desId+'" onclick="remove('+type+','+desId+')" class="remove" name="<?php echo $type; ?>"></span></a> '); that is how I append the data and it is working fine, But on the "remove(type,desId)" function on: function remove(type,id){ Alert(type); } the id is working fine, but on the type everytime I alert it it return "javascript:void(0)"> What is that happening,? ? Quote Link to comment Share on other sites More sharing options...
jugesh Posted April 24, 2013 Share Posted April 24, 2013 Try this <a href=javascript:void(0)" id="'+type+'-'+desId+'" class="admin-managers"> Quote Link to comment Share on other sites More sharing options...
jugesh Posted April 24, 2013 Share Posted April 24, 2013 I need to check ur remove function as well.. can u paste the whole code Quote Link to comment Share on other sites More sharing options...
Solution nogray Posted April 24, 2013 Solution Share Posted April 24, 2013 If type is not numerical value, you need to enclose it quotes in your onclick event, eg onclick="remove(\''+type+'\','+desId+')" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.