[Solved] how to upload images in wordpress by custom code

<?php wp_enqueue_script(‘jquery’); wp_enqueue_media();//enqueue these default wordpress file ?> <div> <label for=”image_url”>Picture:</label> <img scr=”” id=”image_url2″>//for show instant image <input type=”hidden” name=”image_url2″ id=”image_url_2″ class=”regular-text” value=””> <input type=”button” name=”upload-btn” id=”upload-btn-2″ class=”button-secondary” value=”Upload Image”> </div> ———————————javascript——————————- $(‘#upload-btn-2’).click(function(e) { e.preventDefault(); var image = wp.media({ title: ‘Upload Image’, // mutiple: true if you want to upload multiple files at once multiple: … Read more

[Solved] How to capture null in javascript

$(null) is an empty jQuery object, not null. And all objects are truthy. If you want to test null, use this === null. You don’t need jQuery for this. However, I don’t see why do you expect this to be null sometimes. Instead, it seems you want to ignore whitespace text nodes. var $elements = … Read more

[Solved] My code dont works but I don’t know why [closed]

Change the data-target to the correct element id. In your case #bs-example-navbar-collapse-1 is the element id you want: <button type=”button” class=”navbar-toggle collapsed” data-toggle=”collapse” data-target=”#bs-example-navbar-collapse-1″ aria-expanded=”false” aria-controls=”navbar”> solved My code dont works but I don’t know why [closed]

[Solved] How to remove empty th and td from thead and tbody from the HTML table which has no id, Jquery or Javascript

Try this: you can use parent div selector to find the table and then its header and td elements to check if these elements are empty and delete it $(function(){ $(“div.ui-datatable-tablewrapper table[role=grid] thead tr th”).each(function(){ var text = $(this).text(); if(!text && !$(this).find(‘input’).length) { $(this).remove(); } }); $(“div.ui-datatable-tablewrapper table[role=grid] tbody tr td”).each(function(){ var text = $(this).text(); … Read more

[Solved] Javascript RPG game

Your second prompt statement does not assign anything to userinput. Try this: { userinput = prompt(‘Enter direction (North,East,South,West or Q)’, ‘Q’); // ********** Go North ****************** if (userinput === ‘North’) userinput = prompt(‘Would you like to go down Hole 1 or Hole 2?’); { if (userinput === ‘Hole 1’) { alert(‘You have found food for … Read more

[Solved] Change Background Color & Font Color Automatically Via CSS [closed]

What you looking for is @keyframe. Here is simmilar problemCSS background color keyframes animation @keyframes animation { 0% {background-color:red;} 50.0% {background-color:blue;} 100.0% {background-color:red;} } http://jsfiddle.net/yjsh9613/ I think keyframes works pretty well for this one, here is example: https://codepen.io/jerrykck/pen/eYZERPe 1 solved Change Background Color & Font Color Automatically Via CSS [closed]

[Solved] Function that takes an input between 0 and 5 and outputs an array of 5 elements that will be used for generating 5 stars in the UI [closed]

Function that takes an input between 0 and 5 and outputs an array of 5 elements that will be used for generating 5 stars in the UI [closed] solved Function that takes an input between 0 and 5 and outputs an array of 5 elements that will be used for generating 5 stars in the … Read more

[Solved] how i get title from following response [closed]

Assuming your JSON is assigned to a variable called response you can access the body with:let body = response.data.data[0].body And the title withlet title = response.data.data[0].title In case you want to loop over the data array in order to get a value for all entries (e.g. title), try this:let titles = response.data.data.forEach(entry => console.log(entry.title)); 0 … Read more

[Solved] How to slice every array that are within an array JavaScript [closed]

Use a forEach() loop or map() and simply push the sliced original array items into the second array. var array= [ [1,”dataA”,”dataB”,”dataC”,”dataD”], [2,”dataA”,”dataB”,”dataC”,”dataD”], [3,”dataA”,”dataB”,”dataC”,”dataD”], [4,”dataA”,”dataB”,”dataC”,”dataD”] ]; var resultSecondArray= []; array.forEach (function(arr){ resultSecondArray.push(arr.slice(0,3)); }) console.log(resultSecondArray); // gives [[1, “dataA”,”dataB”],[2, “dataA”,”dataB”],[ 3, “dataA”, “dataB”],[ 4,”dataA”, “dataB”]] Using a map() to get the same result let array= [ … Read more