JS object go to jquery object
| The code is as follows |
Copy Code |
Joan Taiwan blog JS and jquery objects to each other JS Get Object var obj = document.getElementById (' id '); Convert a JS object to a jquery object var $obj = $ (obj); |
jquery object go to JS object
| The code is as follows |
Copy Code |
Joan Taiwan blog JS and jquery objects to each other jquery Get Objects var $obj = $ (' #id '); jquery object conversion to JS object var obj = $obj. Get (0); |
JavaScript Object array and JSON convert to each other
| code is as follows |
copy code |
| var thing = { Plugin: ' Jquery-json ', Version:2.3};//js object var encoded = $.tojson (thing); ///Convert to JSON, result: ' {plugin ': ' jquery- JSON ", Version: 2.3} ' var name = $.evaljson (encoded). Plugin; //js object. Property, Result:" Jquery-json " var version = $.evaljson (encoded). version; //Result: 2.3 |