preg_replace/string_replace symbol – or * to space

A few ways to do this. String replace, as mentioned by Ashish. $input = “-**abcd1234-*—“; $output = str_replace(array(‘-‘, ‘*’), ”, $input); echo $output; If you have a large number of characters to strip though, maybe this would be a little easier. $input = “-**abcd1234-*—“; $remove = “-*”; $output = str_replace(str_split($remove), ”, $input); echo $output; And … Read more

Add new row in html dynamically using jQuery

Not really sure what you are after sorry, but the following might help you out. $(document).ready(function () { $(‘#my_button’).click( function (e) { var dynamic_html = “<tr>whatever data you want (including raw html) </tr>”; jQuery(‘#my_table’).append(dynamic_html); }); } Inside the “dynamic_html” you can put any text/html that you want. You can add in your table cells and … Read more

When I add alert('now it works'); this function works but I don't want this

You might read the value of the input field by using a jQuery’s ID selector for the field. Then simply append the value to the URL. It’s a GET request. function a() { $.ajax({ type: ‘GET’, url: ‘z.php?ac=” + $(“#myInputfield”).val(), success: function(data){ console.log(“it works. data: ‘ + data); } }); } This is not the … Read more

How to display an chage photo option on mouse hover similar to linkedin using Javascript? [closed]

If I understand what you need.. You don’t need JavaScript, only css. .wrapper { position:relative; display:inline-block; } .file-wrapper { opacity:0; transition:all .3s ease; position:absolute; bottom:0; left:50%; text-align:center; transform:translateX(-50%); } .wrapper:hover .file-wrapper { opacity:1; } input { opacity: 0; position: absolute; z-index: 2; top: 0; left: 0; width: 100%; height: 100%; } .button { background:#000; color:#fff; … Read more

JQuery change border color for 10 seconds

Use setTimeout for that. $(document).ready(function() { var timer; $(‘div’).click(function() { // cancel previous timeout clearTimeout(timer); var self = $(this); // set new border collor. Or add new class for CSS integration self.css(‘border-color’, ‘green’); timer = setTimeout(function() { // reset CSS self.css(‘border-color’, ”); }, 5000); // time in miliseconds, so 5s = 5000ms }); }); div … Read more

How do I redirect to another webpage?

One does not simply redirect using jQuery jQuery is not necessary, and window.location.replace(…) will best simulate an HTTP redirect. window.location.replace(…) is better than using window.location.href, because replace() does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking … Read more