Javascript Split Function and Jquery not working together -


the variables of url need parsed. have made jquery object of document.location , have used attr function search attribute variables. when use split function on , after each() used gives error stating object not have method each .

typeerror: object [object array] has no method 'each'   

code :

 $(document.location).attr('search').split('&').each() 

i have tried use search property in first function not allow i.e $(document.location.search) gives error.

i have checked data type of returned split function, console says object, confused should have been array.

p.s : above code goes in document.ready function of jquery

making jquery object document.location object pointless, because it's not dom element.

just search property object, , use $.each method intead of .each looping array, not elements:

$.each(document.location.search.split('&'), function(){   ... }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -