0

I have a jquerymobile app, that has this header code

@section header
{
@Html.ActionLink("Cancelar", "DocsCancelar", "Docs", new { area = "Documentos" }, new { StrIdDocumento = "", data_icon="delete" })
<h1 id="NombreItem">Ubicacion 50 </h1>
@Html.ActionLink("Grabar", "DocsGuardar", "Docs", new { area = "Documentos",StrIdDocumento = SessionBag.Current.StrIdDocumento }, new { data_icon="check" })
}

I want to change the text at

<h1>****</h1> tag. 

I have this jquery function

$(data).find('NombreItem').each(function () {
    $('#NombreItem').replaceWith($(this).text());
})

But this replace the entire tag, the only thing I need to change is Ubicacion 50 for Ubicacion 70 or something like that.

2 Answers 2

1

Just do: $('#NombreItem').text(newText);

Sign up to request clarification or add additional context in comments.

4 Comments

Fantastic, jquery is really simple but I'm just starting with it.
What about change an attribute... somethin like change href of an a tag ?
@JuanPabloGomez .attr("href", ...)
Excellent very tks for your help
0

Why not wrap the Ubicacion text in a span tag with id="replaceText", and then just replace the whole tag?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.