Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery replace h1 with h2

$(selector).load(url, function(){ // your existing load function
      $(selector).find('h1').replaceWith(function() {
                return '<h2>' + $(this).text() + '</h2>';
      });
});
Comment

convert h2 to h1 jQuery

/***
   Changes an HTML elements HTML tag from one type to another
   @ Params:
   elemSelector - the css selector of the element you want to change
   tagType - the type of tag to change the element to
 ***/
function changeHTMLTag(elemSelector,tagType)
{
    jQuery(elemSelector).replaceWith(
	function()
	{
	    return jQuery("<"+ tagType +">", {class: this.className, html: jQuery(this).html()});
	}
    );
}
// example usage:
changeHTMLTag('#myElement','h2'); // This will change the element into a h2 tag
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript splice method 
Javascript :: node_modules is not generated in docker 
Javascript :: select item from list javascript 
Javascript :: how to create session cookie in node js 
Javascript :: how to return true or false based on condition by looping arrayin react 
Javascript :: inheritence in javascript 
Javascript :: events in node js 
Javascript :: how to multiply two array in javascript 
Javascript :: Obtener url base 
Javascript :: access data from dofferent file in js 
Javascript :: modify an array in javascript using function method 
Javascript :: grouping related html form input 
Javascript :: frompromise rxjs example 
Javascript :: with jquery Make a style menu that displays paragraphs and hides them according to the style of the slides 
Javascript :: getting-host-is-not-configured-error-when-using-next-image 
Javascript :: nodejs mysql Getting the number of affected rows 
Javascript :: Plumsail set form lookup field value on form load 
Javascript :: ongobd add key value to record 
Javascript :: filter by last month 
Javascript :: infinite typing effect react 
Javascript :: ziggy vue 3 
Javascript :: angularjs promise .then() to run sequentially inside a for loop 
Javascript :: angularjs Ionic styling container 
Javascript :: How to pass React Native Component as a JSON object 
Javascript :: Target one specific Jquery Data Table theader for CSS styles 
Javascript :: Store input values in array javascript 
Javascript :: to fix a broken class oop javascript 
Javascript :: using parseint in javascript 
Javascript :: function x(a) vs function x(...a) the difference 
Javascript :: vimscript replace function 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =