Panagiotis Koursaris Panagiotis Koursaris - 1 year ago 63
HTML Question

Remove specific attribute after having get from .html() jquery method

I have a search engine for users that works with jquery ajax. The problem is that I want to get a whole of html page except the search inputs.

Take a look to my code:.

$(document).on('change', '.auto-select', function(e){


var tags = $('#auto-tag-script').serialize();
var contracts = $('#auto-contract-script').serialize();
var educations = $('#auto-education-script').serialize();
var towns = $('#auto-town-script').serialize();

runAjax(tags, contracts, educations, towns);


function runAjax(tags, contracts, educations, towns) {
url: 'http://localhost/jobs/public/anazitisi-ergasias?' + tags + '&' + contracts + '&' + educations + '&' + towns





With the above code the search form appears again in my page.

Is there any way to escape this form.

Answer Source

You can hide it 2 ways...before you insert it (best way) or after you insert it

        url: '...'
        // create jQuery object from response
        var $html = $(data);
        //hide within that object
        // insert the object
         /*******   OR ***************/
        //  the html is in the DOM now, can do whatever might be needed to it


For many plugins you would need to insert first and then call the plugin

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download